I'm creating a new custom workflow (working nicely through cbUpdater, had to learn it sometime). Now I took some of Joe's scripts as a starting point and noticed something weird:
The 'getSalesEntityType' is used to check if we are actually working with an account here, by checking against the string 'Accounts'. But when I look up function (https://github.com/vtiger-crm/vtigercrm/blob/master/include/utils/CommonUtils.php#L475-L485) if specifically says: 'returns the tabid, integer type'. So great that it works, but it shouldn't... In the meantime, I checked the setype column in the vtiger_crmentity table and yes, this is a string, not an integer. Just thought I'd point out the comment on the function is wrong.
UPDATE
Just saw I had asked this already in a different thread a couple of months ago....
PHP Code:
list($acc,$acc_id) = explode('x',$entity->data['id']); // separate webservice ID
if (getSalesEntityType($acc_id)=='Accounts') {
list($usr,$usr_id) = explode('x', $entity->data['assigned_user_id']);
$query = 'update vtiger_crmentity set smownerid=? where crmid in (select contactid from vtiger_contactdetails where accountid=?)';
$params = array($usr_id, $acc_id);
$adb->pquery($query, $params);
}
The 'getSalesEntityType' is used to check if we are actually working with an account here, by checking against the string 'Accounts'. But when I look up function (https://github.com/vtiger-crm/vtigercrm/blob/master/include/utils/CommonUtils.php#L475-L485) if specifically says: 'returns the tabid, integer type'. So great that it works, but it shouldn't... In the meantime, I checked the setype column in the vtiger_crmentity table and yes, this is a string, not an integer. Just thought I'd point out the comment on the function is wrong.
UPDATE
Just saw I had asked this already in a different thread a couple of months ago....