diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 086379a3989..7f2a5b03ae4 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -396,16 +396,16 @@ class Orders extends DolibarrApi * @return int */ function put($id, $request_data = NULL) { - if(! DolibarrApiAccess::$user->rights->commande->creer) { + if (! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); } $result = $this->commande->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Order not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { + if (! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { @@ -414,12 +414,12 @@ class Orders extends DolibarrApi } // Update availability - if( isset($this->commande->availability_id) && !empty($this->commande->availability_id) ) { - if($this->commande->availability($this->commande->availability_id) < 0) + if (!empty($this->commande->availability_id)) { + if ($this->commande->availability($this->commande->availability_id) < 0) throw new RestException(400, 'Error while updating availability'); } - if($this->commande->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) + if ($this->commande->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) return $this->get($id); return false;