Update invoice with API fails with "productid does not have a value"
With vTiger 6.0.4, when I try to update an invoice, giving the same object i got from a retrieve, even without modifiying it, it fails with "productid does not have a value" error.
Although invoice object doesn't have a productid field in its root data, adding one fix the issue.
Example :
- params = "sessionName=sessionId&operation=retrieve&id=$idinstance";
- httpc->get(endpointUrl."?".$params);
- $response = $httpc->currentResponse();
- jsonResponse = Zend_JSON::decode(response['body']);
- $retrievedObject = $jsonResponse['result'];
We got our invoice.
Works :
- $retrievedObject['productid']=0;
- objectJson = Zend_JSON::encode(retrievedObject);
- params = array("sessionName"=>sessionId, "operation"=>'update', "element"=>$objectJson);
- httpc->post(endpointUrl, $params, true);
- $response = $httpc->currentResponse();
- jsonResponse = Zend_JSON::decode(response['body']);
Doesn't work :
- objectJson = Zend_JSON::encode(retrievedObject);
- params = array("sessionName"=>sessionId, "operation"=>'update', "element"=>$objectJson);
- httpc->post(endpointUrl, $params, true);
- $response = $httpc->currentResponse();
- jsonResponse = Zend_JSON::decode(response['body']);