Creating Salesorder with Vtiger Webservice missing Tax - web-services

I have the Problem when creating an salesorder with Vtiger Webservice,
The sales order is created but somehow the tax is not added.
I thought it has something to do with the parameter : hdnTaxType
Cause even if I add this value 'group' it does not apply the Tax to the Salesorder.
I have to manually add The Taxtype 'group' then the system adds the tax.
thats why i tried to add values like:
'tax1' => '7.00',
and
'group_tax' =>[
'group_tax_percentage1' => '7.0'
],
nothing so far did help...
has anybody an Idea what the problem is?
Thank you
Tobi
$salesOrder =[
'lastname' => $customer['lastname'],
'subject' => 'Order from 01.01.1018',
'sostatus' => '1',
'assigned_user_id' => '',
'bill_street' => 'Rechunngsstrasse 123',
'ship_street' =>'Lieferungsstrasse 123',
'productid' => '14x4325',
'currency_id' => '21x1',
'carrier' => 'DHL',
'txtAdjustment' => '13',
'salescommission' => '12',
'exciseduty' => '15',
'hdnTaxType' => 'group',
'tax1' => '7.00',
'hdnS_H_Amount' => '22.22',
'group_tax' =>[
'group_tax_percentage1' => '7.0'
],
'LineItems' => [
0 => [
"taxid" => "33x1",
'productid'=>'14x6',
'listprice'=>'20.53',
'quantity'=>'3',
'comment' => "Product123"
]
]

Webservices in Vtiger are not complete.
In this case you can register your own webservice that makes your queries, or check the SalesOrder in the after-save event

Related

Creating a table of data submitted on form submit using ajax without saving the data in the database. - Drupal8

Here is the requirement that I need to achieve in Drupal8.
Add user email and show it in a table format row wise
The user will enter the email and click on the Add button. Then the added emails will be shown in a table format just below the form with remove link. It will be a ajaxified form.
Below is the code that I have used.
public function buildForm(array $form, FormStateInterface $form_state) {
$form['email'] = [
'#type' => 'email',
'#placeholder' => $this->t('Enter Email address To Add'),
'#required' => TRUE,
];
// Attach Ajax callback to the Submit button.
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Add'),
'#ajax' => array(
'callback' => '::ajaxAddEmailRow',
'event' => 'click',
'wrapper' => 'email-row-wrapper',
),
];
$header = [
'email' => t('Email'),
'accounttype' => t('Account Type'),
'permission' => t('Permission Level'),
'operation' => t('Operation'),
];
// For testing only.
$rows[0] = array(
'email' => 'test1#gm.com',
'accounttype' => 'account',
'permission' => 'permission',
'operation' => 'operation',
);
$form['email_rows'] = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#prefix' => '<div id="email-row-wrapper">',
'#suffix' => '</div>',
'#empty' => t('No users found'),
];
return $form;
}
Any help or guidance highly appreciated. Thanks.

How to get a full_html textarea field in a Drupal 8 configuration form?

In my module I have a configuration form (ConfigFormBase) with a simple textarea field without formatting that works correctly.
$form['page_message'] = [
'#type' => 'textarea',
'#title' => $this->t('Message'),
'#description' => $this->t('Message display to customer contacts.'),
'#default_value' => $config->get('page_message'),
];
But I would like a textarea full_html field.
Is this possible and how with Drupal 8?
Yes it is possible, but you have to do it like this:
$form['page_message'] = [
'#type' => 'text_format',
'#title' => $this->t('Message'),
'#format' => 'full_html',
'#description' => $this->t('Message display to customer contacts.'),
'#default_value' => $config->get('page_message'),
];
You can check Drupal api for TextFormat.php here, just click on view source and you will have all the info you need.

Query string in drupal service custom resources

I am trying to use query string structure in drupal services API. it's not working for me.
I have also search most of the solutions, but all failed.
here is m drupal code:
function rapid_services_resources() {
$resources = array(
'get_data' => array(
'operations' => array(
'retrieve' => array(
'help' => t('Gets user email of uid passed.'),
'callback' => 'my_module_get_user_email',
'args' => array(
array(
'name' => 'nid',
'type' => 'int',
'description' => 'The display ID of the view to get.',
'source' => array('param' => 'nid'),
'optional' => TRUE,
'default value' => 'default',
),
),
'access arguments' => '_blog_access_provide_access',
'access callback' => '_blog_access_provide_access',
//~ 'access arguments append' => FALSE,
),
),
),
);
return $resources;
}
function _blog_access_provide_access() {
return TRUE;
}
function my_module_get_user_email($nid){
var_dump($args);die;
}
I want url like this.:
http://localhost/drupaltest/rapidapi/get_data/?nid=111
Please let me know where i did wrong.
thanks in advance.
Hi here are to reference that will be useful
http://pingv.com/blog/an-introduction-drupal-7-restful-services
https://www.drupal.org/node/783460
Also I am not sure about the query string, but for the retrieve operation you can set it as part of the url
ex:
http://localhost/drupaltest/rapidapi/get_data/<nid should be here>
http://localhost/drupaltest/rapidapi/get_data/111
Also using the source path as source
'source' => array('path' => '0'),
I would think that source param only works for an index operation and not retrieve

Need to display Subject (Mail subject) - Vtiger CRM

I need to display Mail subject in Related tab Grid of Lead module
I have checked getRelationQuery() function in that I got a subject, but while on the EmailRelatedlist.tpl file, the subject data is not displayed.
How we can display the Subject on the Related tab?
can you please go to below file and change below code
modules\Emails\Emails.php
var $list_fields = Array(
'Subject' => Array('activity' => 'subject'),
'Related to' => Array('seactivityrel' => 'parent_id'),
'Date Sent' => Array('activity' => 'date_start'),
'Time Sent' => Array('activity' => 'time_start'),
'Assigned To' => Array('crmentity', 'smownerid'),
'Access Count' => Array('email_track', 'access_count')
);
var $list_fields_name = Array(
'Subject' => 'subject',
'Related to' => 'parent_id',
'Date Sent' => 'date_start',
'Time Sent' => 'time_start',
'Assigned To' => 'assigned_user_id',
'Access Count' => 'access_count'
);

Cakephp validating if my user checked at least one option

I have a problem validating if my user checked at least one option from a list of checkboxes.
Here is what i tried:
My view looks like this:
echo $this->Form->input('market_segment_targeted', array(
'multiple' => 'checkbox',
'label'=>array('text' => 'Market segment targeted', 'class'=>'w120'),
'options' => array(
'Home users' => 'Home users',
'SOHO' => 'SOHO',
'SMB' => 'SMB',
'Enterprise' => 'Enterprise'
),
));
In my controller i have added this snippet of code:
$validate_on_fly = array(
'market_segment_targeted' => array(
'notEmpty' => array(
'rule' => array('multiple', array('min' => 1)),
'required' => true,
'message' => 'Please select at least one!'
))
)));
$this->Partner->validate = Set::merge(
$this->Partner->validate,
$validate_on_fly
);
Any ideas what am i doing wrong?
Thank you
In CakePHP you can use Model Validation for checkboxes. Here is a quick example.
Your Form can look like:
$this->Form->create('User');
$this->Form->input('User.agree', array('type'=>'checkbox', 'hiddenField'=>false, 'value'=>'0'));
$this->Form->submit('Save'):
$this->Form->end();
Then in your Model under public $validate, use:
'agree'=>array(
'Not empty'=>array(
'rule'=>array('comparison', '!=', 0),
'required'=>true,
'message'=>'You must agree to the ToS'
)
)