Hi,
It update fine label, description, etc… but not the price.
I’ve started to analyse and tI propose this code for solving :
function put($id, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->produit->creer) {
throw new RestException(401);
}
$result = $this->product->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Product not found');
}
if( ! DolibarrApi::_checkAccessToResource('product',$this->product->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->product->$field = $value;
}
if($this->product->update($id, DolibarrApiAccess::$user,1,'update')) {
$this->product->updatePrice($this->product->price, $this->product->price_base_type, DolibarrApiAccess::$user, $this->product->tva_tx,'', 0, 0, 0, 0, array(), '');
return $this->get ($id);
}
return false;
}