From 9c254159ab8dad8477c1814beaaf2f6c54d30c4b Mon Sep 17 00:00:00 2001 From: Egils Consulting Date: Fri, 7 Aug 2020 00:06:48 +0200 Subject: [PATCH] Update api_products.class.php fixes #14309 Throw 400 and add hint to user about using the right endpoint. --- htdocs/product/class/api_products.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1f4bbf870f3..89c9a78ddaa 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -286,6 +286,9 @@ class Products extends DolibarrApi foreach ($request_data as $field => $value) { if ($field == 'id') { continue; + } + if ($field == 'stock_reel') { + throw new RestException(400, 'Stock reel cannot be updated here. Use the /stockmovements endpoint instead'); } $this->product->$field = $value; }