Skip to content
Snippets Groups Projects
Commit 0012cd81 authored by Jean-François Ferry's avatar Jean-François Ferry
Browse files

Fix API category class

parent 967e8c66
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,7 @@ class CategoryApi extends DolibarrApi {
* Return an array with category informations
*
* @url GET category/{id}
*
* @param int $id ID of category
* @return array|mixed data without useless information
*
......@@ -80,7 +81,7 @@ class CategoryApi extends DolibarrApi {
*/
function get($id)
{
if(! DolibarrApiAccess::$user->rights->category->lire) {
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
......@@ -292,7 +293,7 @@ class CategoryApi extends DolibarrApi {
$this->category->$field = $value;
}
if($this->category->update($id, DolibarrApiAccess::$user,1,'','','update'))
if($this->category->update(DolibarrApiAccess::$user))
return $this->get ($id);
return false;
......@@ -319,7 +320,16 @@ class CategoryApi extends DolibarrApi {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->category->delete($id);
if (! $this->category->delete(DolibarrApiAccess::$user)) {
throw new RestException(401,'error when delete category');
}
return array(
'success' => array(
'code' => 200,
'message' => 'Category deleted'
)
);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment