From 59d9ab731ecae2cebae7f3f0dddb1b95e2db8767 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Nov 2017 01:29:28 +0100 Subject: [PATCH] Add param $idwarehouse to settodraft --- htdocs/commande/class/api_orders.class.php | 7 ++++--- htdocs/commande/class/commande.class.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 8bfed9d4eb4..e5228185657 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -555,12 +555,13 @@ class Orders extends DolibarrApi * Set an order to draft * * @param int $id Order ID + * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * * @url POST {id}/settodraft * * @return array */ - function settodraft($id) + function settodraft($id, $idwarehouse=-1) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -574,7 +575,7 @@ class Orders extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->commande->set_draft(DolibarrApiAccess::$user); + $result = $this->commande->set_draft(DolibarrApiAccess::$user, $idwarehouse); if ($result == 0) { throw new RestException(304, 'Nothing done. May be object is already closed'); } @@ -582,7 +583,7 @@ class Orders extends DolibarrApi throw new RestException(500, 'Error when closing Order: '.$this->commande->error); } - $result = $this->commande->fetch($id); + $result = $this->commande->fetch($id); if( ! $result ) { throw new RestException(404, 'Order not found'); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 04ba162cb9e..26674818027 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -416,7 +416,7 @@ class Commande extends CommonOrder * Set draft status * * @param User $user Object user that modify - * @param int $idwarehouse Id warehouse to use for stock change. + * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ function set_draft($user, $idwarehouse=-1)