FIX API template to delete a record
This commit is contained in:
parent
499d93b8c4
commit
781a55429a
@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user