API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Error in converting stdclass object to int

0
Hi experts,

when am create a order using order_create()
i got this error,
Uncaught SoapFault exception: [soap:Client] Economic.Api.Exceptions.ValidationException(E04000): Debtor number string must be a legal integer.

source code :


  
   while($row = mysql_fetch_array($result))
  {
  //echo $row['firstname'] ;
   //echo'br/';

   $newDebtorHandle = $client-Debtor_FindByNumber(array('number' = $row['customer_id']));
  
   print_r(count($newDebtorHandle));echo br/;
   
  // echo intval($newDebtorHandle);
      $productGroupHandels = $client-productGroup_GetAll()-ProductGroup_GetAllResult-ProductGroupHandle;
      $productHandle = $client-Product_FindByNumber(array('number' = $product_data['0']['product_id'] ));
        $orderno = $client-Order_Create(array('debtorHandle' = $newDebtorHandle))-Order_CreateResult;
        }


error at $orderno,

error desc :


Fatal error: Uncaught SoapFault exception: [soap:Client] Economic.Api.Exceptions.ValidationException(E04000): Debtor number string must be a legal integer. (id=79074131-bd93-438c-9779-14ec52187eb2)

can any one fix it..
created Mar 13, 2013 by sudheerphp
22% Accept Rate
Q 14 A 10 C 0

1 Answer

0

$newDebtorHandle = $client-Debtor_FindByNumber(array('number' = $row'customer_id'))-Debtor_FindByNumberResult;

Give that a try
answered Mar 18, 2013 by PhpMadman
I got this error to, but from another call. The code above works.

I don't know if it is a bug or if its suposed to be like this but, when using
$debHandle = $client->Debtor_FindByEmail(array("email" => $orderdata["Email"]))->Debtor_FindByEmailResult;

I get this stdClass Object ( [DebtorHandle] => stdClass Object ( [Number] => 1 ) )

But using my the code above as this $newDebtorHandle = $client->Debtor_FindByNumber(array('number' => $debHandle->DebtorHandle->Number))->Debtor_FindByNumberResult;

gives the following stdClass Object ( [Number] => 1 )

So to be able to create an order by using the emal to get debtor the code must be like this         $OrderHandle = $client->Order_Create(array('debtorHandle' =>  $debHandle->DebtorHandle))->Order_CreateResult;

Instead of as I normally do.
        $OrderHandle = $client->Order_Create(array('debtorHandle' =>  $newDebtorHandle))->Order_CreateResult;
Visma e-conomic A/S
...