FIX API template to delete a record

This commit is contained in:
Laurent Destailleur 2018-08-23 20:03:41 +02:00
parent 499d93b8c4
commit 781a55429a

View File

@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi
*/ */
function delete($id) function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->myobject->supprimer) { if(! DolibarrApiAccess::$user->rights->myobject->delete) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->myobject->fetch($id); $result = $this->myobject->fetch($id);
@ -267,7 +267,7 @@ class MyModuleApi 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);
} }
if( !$this->myobject->delete($id)) if( !$this->myobject->delete(DolibarrApiAccess::$user, 0))
{ {
throw new RestException(500); throw new RestException(500);
} }