[Vtigercrm-developers] Error on vtiger 8.4 Webservice utils

Alexander Allen alexander.allenz at gmail.com
Fri Jul 18 17:49:45 GMT 2025


I'm trying to create an Invoice from webservice. I can create as example
products but the error is when it loads lineitems. This is part of my code:

include_once 'include/Webservices/Create.php';
$data = array (
'subject' => 'Pedido',
'productid' => '14x23683',
'ship_street' => $direccion,
'ship_state' => $cliente,
'currency_id' => $moneda,
'account_id' => $clientId,
'invoicestatus' => 'Cancel',
'assigned_user_id' => $propietario, // 19=Users Module ID, 1=First user
Entity ID
'LineItems'=>$productos,

);
vtws_create('Invoice', $data, $current_user);

I get this error
*Fatal error*: Uncaught WebServiceException: Id specified is incorrect in
/vtiger/include/Webservices/Utils.php:127 Stack trace: #0
/vtiger/include/Webservices/LineItem/VtigerInventoryOperation.php(469):
vtws_getIdComponents('') #1

I found that vtiger changes  function vtws_getIdComponents in
include/Webservice/Utils.php from this:

function vtws_getIdComponents($elementid){
     return explode("x",$elementid);
}

to this:

function vtws_getIdComponents($elementid){
   $elementid = (string)$elementid;

   if ($elementid && is_numeric($elementid)) return array($elementid); //
during (UserId permission check)


   if (!$elementid || !preg_match("/[0-9]+x[0-9]+/", $elementid)) {
   throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Id
specified is incorrect");
   }

   return explode("x",$elementid);
}

Does someone know why this change has made or is an error?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250718/582c74b5/attachment.html>


More information about the vtigercrm-developers mailing list