Add param $idwarehouse to settodraft
This commit is contained in:
parent
a12186a0b8
commit
59d9ab731e
@ -555,12 +555,13 @@ class Orders extends DolibarrApi
|
|||||||
* Set an order to draft
|
* Set an order to draft
|
||||||
*
|
*
|
||||||
* @param int $id Order ID
|
* @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
|
* @url POST {id}/settodraft
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function settodraft($id)
|
function settodraft($id, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -574,7 +575,7 @@ class Orders extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
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) {
|
if ($result == 0) {
|
||||||
throw new RestException(304, 'Nothing done. May be object is already closed');
|
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);
|
throw new RestException(500, 'Error when closing Order: '.$this->commande->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Order not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -416,7 +416,7 @@ class Commande extends CommonOrder
|
|||||||
* Set draft status
|
* Set draft status
|
||||||
*
|
*
|
||||||
* @param User $user Object user that modify
|
* @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
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_draft($user, $idwarehouse=-1)
|
function set_draft($user, $idwarehouse=-1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user