[Vtigercrm-developers] Error on vtiger 8.4 Webservice utils
Alexander Allen
alexander.allenz at gmail.com
Sat Jul 19 00:00:56 GMT 2025
Is in line_items. Id is the invoice id but in invoice creation there is not
an id until its created.
On Fri, 18 Jul 2025 at 5:57 PM Rubén A. Estrada Orozco <rulotec1 at gmail.com>
wrote:
> I presume that the id you are passing as a parameter might be empty.
>
> It seems the change in code aimed at validating the input parameter passed
> to the function. I would change the exception message to:
>
> throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Id
> specified is incorrect ->" . print_r($elementid, true) . "<-");
>
> and see what gets printed out. But my guess would be an empty $elementid.
>
> On Fri, Jul 18, 2025 at 11:52 AM Alexander Allen <
> alexander.allenz at gmail.com> wrote:
>
>> 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?
>>
> _______________________________________________
>> http://www.vtiger.com/
>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250718/4d52a5d1/attachment-0001.html>
More information about the vtigercrm-developers
mailing list