Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sometimes the save method takes an admin user as current user
#5
Well this is one of the webservice calls, no real standard URL's since they are all custom:

PHP Code:
    $worksheet json_decode($_REQUEST['data'], true);

    
$hdnGrandTotal number_format($worksheet['data']['mandatoryFields']['mand_hdnGrandTotal'], 2","".");
    
$hdnSubTotal number_format($worksheet['data']['mandatoryFields']['mand_hdnSubTotal'], 2","".");

    
$params = array(
            
'id' => $worksheet['data']['id'],
            
'sostatus' => $worksheet['data']['newStatus'],
            
'subject' => $worksheet['data']['mandatoryFields']['mand_subject'],
            
'contact_id' => $worksheet['data']['mandatoryFields']['mand_contact_id'],
            
'account_id' => $worksheet['data']['mandatoryFields']['mand_account_id'],
            
'bill_street' => $worksheet['data']['mandatoryFields']['mand_bill_street'],
            
'ship_street' => $worksheet['data']['mandatoryFields']['mand_ship_street'],
            
'hdnGrandTotal' => $hdnGrandTotal,
            
'hdnSubTotal' => $hdnSubTotal,
            
'assigned_user_id' => $worksheet['data']['mandatoryFields']['mand_assigned_user_id']
        );

    
// Add custom fields to params, if any
    
if (count($worksheet['data']['customFields']) > 0) {
        foreach (
$worksheet['data']['customFields'] as $cf_no => $value) {
            
$params[$cf_no] = $value;
        }
    }

    
$client->doInvoke('createWorkSheetHTML',
                        array(    
'id'             => $worksheet['data']['id'], 
                                
'autograph'     => $worksheet['data']['signature'],
                                
'lines'         => json_encode($worksheet['data']['materials']),
                                
'autogr_name'    => $worksheet['data']['autogr_name'],
                                
'times'            => json_encode($worksheet['data']['times'])
                                ),
                        
'POST');

    
// Convert materials to a string
    
$materials '';
    foreach(
$worksheet['data']['materials'] as $material) {
        
$materials .= $material['qty'] . ' X ' $material['desc'] . ', ';
    }
    
$params['cf_968'] = $materials;

    
$r $client->doUpdate('SalesOrder'$params); 

And here is an event listener for after a relation has been created, that does some specific functions on the related module record. Sometimes this related record gets related to me, sometimes it doesn't...
Reply


Messages In This Thread
RE: Sometimes the save method takes an admin user as current user - Guido1982 - 10-15-2017, 07:56 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)