mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
NEW Add REST api for commercial proposals
This commit is contained in:
@@ -449,10 +449,11 @@ class Orders extends DolibarrApi
|
||||
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||
* Workaround: send this in the body
|
||||
* {
|
||||
* "idwarehouse": 0
|
||||
* "idwarehouse": 0,
|
||||
* "notrigger": 0
|
||||
* }
|
||||
*/
|
||||
function validate($id, $idwarehouse=0)
|
||||
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
@@ -466,10 +467,14 @@ class Orders extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse)) {
|
||||
throw new RestException(500, 'Error when validate order');
|
||||
}
|
||||
|
||||
$result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||
}
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
|
||||
Reference in New Issue
Block a user