Merge pull request #11346 from ptibogxiv/patch-189

Fix add / delete contact access in order API
This commit is contained in:
Laurent Destailleur 2019-06-16 17:26:50 +02:00 committed by GitHub
commit a6c5dc9a46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 22 deletions

View File

@ -420,16 +420,11 @@ class Orders extends DolibarrApi
} }
$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');
} }
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) { if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
}
if(!DolibarrApi::_checkAccessToResource('order', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -462,12 +457,11 @@ class Orders extends DolibarrApi
} }
$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');
} }
if(!DolibarrApi::_checkAccessToResource('order', $this->commande->id)) { if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }

View File

@ -27,6 +27,7 @@ CREATE TABLE llx_bom_bom(
qty double(24,8), qty double(24,8),
efficiency double(8,4) DEFAULT 1, efficiency double(8,4) DEFAULT 1,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
date_valid datetime NOT NULL,
tms timestamp, tms timestamp,
date_valid datetime, date_valid datetime,
fk_user_creat integer NOT NULL, fk_user_creat integer NOT NULL,