[Vtigercrm-developers] Error on vtiger 8.4 Webservice utils
Alexander Allen
alexander.allenz at gmail.com
Mon Jul 21 19:22:59 GMT 2025
Its correct, but at that moment I dont have a invoice_id. My concern is
that with vtiger 8.3 it works fine. And the difference between 8.3 and 8.4
in the code is that.
El vie, 18 jul 2025 a las 20:07, Rubén A. Estrada Orozco (<
rulotec1 at gmail.com>) escribió:
> You should do a print_r of the whole $data array to see the actual
> contents. You have a $productos variable in the LineItems element. Since
> the error is here "Stack trace: #0
> /vtiger/include/Webservices/LineItem/VtigerInventoryOperation.php(469)" I
> suspect it's one of your line items that's causing the problem.
>
> You could also do a print_r of the $element parameter in
> VtigerInventoryOperation::constructFocusObject($element)
>
> [image: image.png]
>
> On Fri, Jul 18, 2025 at 6:02 PM Alexander Allen <
> alexander.allenz at gmail.com> wrote:
>
>> 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/
>>
>> _______________________________________________
>> http://www.vtiger.com/
>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250721/3f968946/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 74021 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20250721/3f968946/attachment-0001.png>
More information about the vtigercrm-developers
mailing list