This commit is contained in:
Laurent Destailleur 2017-03-16 22:36:44 +01:00
parent 7dd0f14563
commit dfc1ed7d72
5 changed files with 46 additions and 7 deletions

View File

@ -248,6 +248,7 @@ class Categories extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No category found');
}
return $obj_ret;
}
@ -351,9 +352,47 @@ class Categories extends DolibarrApi
$object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource.
//unset($object->subscriptions);
// Remove fields not relevent to categories
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->total_ht);
unset($object->total_ht);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
unset($object->total_tva);
unset($object->lines);
unset($object->fk_incoterms);
unset($object->libelle_incoterms);
unset($object->location_incoterms);
unset($object->civility_id);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->shipping_method_id);
unset($object->fk_delivery_address);
unset($object->cond_reglement);
unset($object->cond_reglement_id);
unset($object->mode_reglement_id);
unset($object->barcode_type_coder);
unset($object->barcode_type_label);
unset($object->barcode_type_code);
unset($object->barcode_type);
unset($object->canvas);
unset($object->cats);
unset($object->motherof);
unset($object->context);
unset($object->socid);
unset($object->thirdparty);
unset($object->contact);
unset($object->contact_id);
unset($object->user);
unset($object->fk_account);
unset($object->fk_project);
unset($object->note);
unset($object->statut);
return $object;
}

View File

@ -291,7 +291,7 @@ class CategoryApi extends DolibarrApi
* @url GET /customer/{cusid}/categories
*/
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid);
}
/**

View File

@ -264,7 +264,7 @@ class Products extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id);
}
/**

View File

@ -318,7 +318,7 @@ class Contacts extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('contact', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id);
}
/**

View File

@ -267,7 +267,7 @@ class Thirdparties extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id);
}
/**