diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index b3a2cdaf9d0e0c6613aecfd112b8f5ca0784af69..00621fdeb595c7cd4289cd032e937f461f777e09 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -88,6 +88,17 @@ class DolibarrApi // Remove $db object property for object unset($object->db); + // Remove the $oldcopy property because it is not supported by the JSON + // encoder. The following error is generated when trying to serialize + // it: "Error encoding/decoding JSON: Type is not supported" + // Note: Event if this property was correctly handled by the JSON + // encoder, it should be ignored because keeping it would let the API + // have a very strange behavior: calling PUT and then GET on the same + // resource would give different results: + // PUT /objects/{id} -> returns object with oldcopy = previous version of the object + // GET /objects/{id} -> returns object with oldcopy empty + unset($object->oldcopy); + // If object has lines, remove $db property if(isset($object->lines) && count($object->lines) > 0) { $nboflines = count($object->lines); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b5eb3d6bd870647fbc0ed343ab7667fe76bdd3ff..ce0a812558e785c057ae15c81d8c17b0a41c3d58 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -275,7 +275,6 @@ class Products extends DolibarrApi * @param int $id Id of product to update * @param array $request_data Datas * @return int - * FIXME The product is correctluy updated but the API returns an error 500. */ function put($id, $request_data = NULL) {