Skip to content

Commit

Permalink
NEW Return the order object when validate
Browse files Browse the repository at this point in the history
Return the order object when the order is validated using the REST API
  • Loading branch information
Neil Orley committed Nov 10, 2017
1 parent 4e9dae5 commit 73fe991
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions htdocs/commande/class/api_orders.class.php
Expand Up @@ -492,13 +492,17 @@ function validate($id, $idwarehouse=0, $notrigger=0)
if ($result < 0) {
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
}
$result = $this->commande->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Order not found');
}

return array(
'success' => array(
'code' => 200,
'message' => 'Order validated (Ref='.$this->commande->ref.')'
)
);
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

$this->commande->fetchObjectLinked();
return $this->_cleanObjectDatas($this->commande);
}

/**
Expand Down

0 comments on commit 73fe991

Please sign in to comment.