dolibarr  16.0.5
api_categories.class.php
1 <?php
2 /* Copyright (C) 2015 Jean-Fran├žois Ferry <jfefe@aternatik.fr>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 use Luracast\Restler\RestException;
19 
20 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
21 require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
22 
23 
24 require_once DOL_DOCUMENT_ROOT.'/adherents/class/api_members.class.php';
25 require_once DOL_DOCUMENT_ROOT.'/product/class/api_products.class.php';
26 require_once DOL_DOCUMENT_ROOT.'/societe/class/api_contacts.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparties.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/projet/class/api_projects.class.php';
29 
36 class Categories extends DolibarrApi
37 {
41  static $FIELDS = array(
42  'label',
43  'type'
44  );
45 
46  static $TYPES = array(
47  0 => 'product',
48  1 => 'supplier',
49  2 => 'customer',
50  3 => 'member',
51  4 => 'contact',
52  5 => 'account',
53  6 => 'project',
54  7 => 'user',
55  8 => 'bank_line',
56  9 => 'warehouse',
57  10 => 'actioncomm',
58  11 => 'website_page',
59  12 => 'ticket',
60  13 => 'knowledgemanagement'
61  );
62 
66  public $category;
67 
71  public function __construct()
72  {
73  global $db, $conf;
74  $this->db = $db;
75  $this->category = new Categorie($this->db);
76  }
77 
89  public function get($id, $include_childs = false)
90  {
91  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
92  throw new RestException(401);
93  }
94 
95  $result = $this->category->fetch($id);
96  if (!$result) {
97  throw new RestException(404, 'category not found');
98  }
99 
100  if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
101  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
102  }
103 
104  if ($include_childs) {
105  $cats = $this->category->get_filles();
106  if (!is_array($cats)) {
107  throw new RestException(500, 'Error when fetching child categories', array_merge(array($this->category->error), $this->category->errors));
108  }
109  $this->category->childs = array();
110  foreach ($cats as $cat) {
111  $this->category->childs[] = $this->_cleanObjectDatas($cat);
112  }
113  }
114 
115  return $this->_cleanObjectDatas($this->category);
116  }
117 
133  public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
134  {
135  global $db, $conf;
136 
137  $obj_ret = array();
138 
139  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
140  throw new RestException(401);
141  }
142 
143  $sql = "SELECT t.rowid";
144  $sql .= " FROM ".MAIN_DB_PREFIX."categorie as t";
145  $sql .= ' WHERE t.entity IN ('.getEntity('category').')';
146  if (!empty($type)) {
147  $sql .= ' AND t.type='.array_search($type, Categories::$TYPES);
148  }
149  // Add sql filters
150  if ($sqlfilters) {
151  $errormessage = '';
152  if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
153  throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
154  }
155  $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
156  $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
157  }
158 
159  $sql .= $this->db->order($sortfield, $sortorder);
160  if ($limit) {
161  if ($page < 0) {
162  $page = 0;
163  }
164  $offset = $limit * $page;
165 
166  $sql .= $this->db->plimit($limit + 1, $offset);
167  }
168 
169  $result = $this->db->query($sql);
170  if ($result) {
171  $i = 0;
172  $num = $this->db->num_rows($result);
173  $min = min($num, ($limit <= 0 ? $num : $limit));
174  while ($i < $min) {
175  $obj = $this->db->fetch_object($result);
176  $category_static = new Categorie($this->db);
177  if ($category_static->fetch($obj->rowid)) {
178  $obj_ret[] = $this->_cleanObjectDatas($category_static);
179  }
180  $i++;
181  }
182  } else {
183  throw new RestException(503, 'Error when retrieve category list : '.$this->db->lasterror());
184  }
185  if (!count($obj_ret)) {
186  throw new RestException(404, 'No category found');
187  }
188  return $obj_ret;
189  }
190 
197  public function post($request_data = null)
198  {
199  if (!DolibarrApiAccess::$user->rights->categorie->creer) {
200  throw new RestException(401);
201  }
202 
203  // Check mandatory fields
204  $result = $this->_validate($request_data);
205 
206  foreach ($request_data as $field => $value) {
207  $this->category->$field = $value;
208  }
209  if ($this->category->create(DolibarrApiAccess::$user) < 0) {
210  throw new RestException(500, 'Error when creating category', array_merge(array($this->category->error), $this->category->errors));
211  }
212  return $this->category->id;
213  }
214 
222  public function put($id, $request_data = null)
223  {
224  if (!DolibarrApiAccess::$user->rights->categorie->creer) {
225  throw new RestException(401);
226  }
227 
228  $result = $this->category->fetch($id);
229  if (!$result) {
230  throw new RestException(404, 'category not found');
231  }
232 
233  if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
234  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
235  }
236 
237  foreach ($request_data as $field => $value) {
238  if ($field == 'id') {
239  continue;
240  }
241  $this->category->$field = $value;
242  }
243 
244  if ($this->category->update(DolibarrApiAccess::$user) > 0) {
245  return $this->get($id);
246  } else {
247  throw new RestException(500, $this->category->error);
248  }
249  }
250 
257  public function delete($id)
258  {
259  if (!DolibarrApiAccess::$user->rights->categorie->supprimer) {
260  throw new RestException(401);
261  }
262  $result = $this->category->fetch($id);
263  if (!$result) {
264  throw new RestException(404, 'category not found');
265  }
266 
267  if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
268  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
269  }
270 
271  if (!$this->category->delete(DolibarrApiAccess::$user)) {
272  throw new RestException(401, 'error when delete category');
273  }
274 
275  return array(
276  'success' => array(
277  'code' => 200,
278  'message' => 'Category deleted'
279  )
280  );
281  }
282 
300  public function getListForObject($id, $type, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
301  {
302  if (!in_array($type, [
303  Categorie::TYPE_PRODUCT,
304  Categorie::TYPE_CONTACT,
305  Categorie::TYPE_CUSTOMER,
306  Categorie::TYPE_SUPPLIER,
307  Categorie::TYPE_MEMBER,
308  Categorie::TYPE_PROJECT,
309  Categorie::TYPE_KNOWLEDGEMANAGEMENT
310  ])) {
311  throw new RestException(401);
312  }
313 
314  if ($type == Categorie::TYPE_PRODUCT && !(DolibarrApiAccess::$user->rights->produit->lire || DolibarrApiAccess::$user->rights->service->lire)) {
315  throw new RestException(401);
316  } elseif ($type == Categorie::TYPE_CONTACT && !DolibarrApiAccess::$user->rights->contact->lire) {
317  throw new RestException(401);
318  } elseif ($type == Categorie::TYPE_CUSTOMER && !DolibarrApiAccess::$user->rights->societe->lire) {
319  throw new RestException(401);
320  } elseif ($type == Categorie::TYPE_SUPPLIER && !DolibarrApiAccess::$user->rights->fournisseur->lire) {
321  throw new RestException(401);
322  } elseif ($type == Categorie::TYPE_MEMBER && !DolibarrApiAccess::$user->rights->adherent->lire) {
323  throw new RestException(401);
324  } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) {
325  throw new RestException(401);
326  } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
327  throw new RestException(401);
328  }
329 
330  $categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page);
331 
332  if (!is_array($categories)) {
333  if ($categories == 0) {
334  throw new RestException(404, 'No category found for this object');
335  }
336  throw new RestException(600, 'Error when fetching object categories', array_merge(array($this->category->error), $this->category->errors));
337  }
338  return $categories;
339  }
340 
353  public function linkObjectById($id, $type, $object_id)
354  {
355  if (empty($type) || empty($object_id)) {
356  throw new RestException(401);
357  }
358 
359  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
360  throw new RestException(401);
361  }
362 
363  $result = $this->category->fetch($id);
364  if (!$result) {
365  throw new RestException(404, 'category not found');
366  }
367 
368  if ($type === Categorie::TYPE_PRODUCT) {
369  if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
370  throw new RestException(401);
371  }
372  $object = new Product($this->db);
373  } elseif ($type === Categorie::TYPE_CUSTOMER) {
374  if (!DolibarrApiAccess::$user->rights->societe->creer) {
375  throw new RestException(401);
376  }
377  $object = new Societe($this->db);
378  } elseif ($type === Categorie::TYPE_SUPPLIER) {
379  if (!DolibarrApiAccess::$user->rights->societe->creer) {
380  throw new RestException(401);
381  }
382  $object = new Societe($this->db);
383  } elseif ($type === Categorie::TYPE_CONTACT) {
384  if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
385  throw new RestException(401);
386  }
387  $object = new Contact($this->db);
388  } elseif ($type === Categorie::TYPE_MEMBER) {
389  if (!DolibarrApiAccess::$user->rights->adherent->creer) {
390  throw new RestException(401);
391  }
392  $object = new Adherent($this->db);
393  } else {
394  throw new RestException(401, "this type is not recognized yet.");
395  }
396 
397  if (!empty($object)) {
398  $result = $object->fetch($object_id);
399  if ($result > 0) {
400  $result = $this->category->add_type($object, $type);
401  if ($result < 0) {
402  if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
403  throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
404  }
405  }
406  } else {
407  throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
408  }
409 
410  return array(
411  'success' => array(
412  'code' => 200,
413  'message' => 'Objects succefully linked to the category'
414  )
415  );
416  }
417 
418  throw new RestException(401);
419  }
420 
433  public function linkObjectByRef($id, $type, $object_ref)
434  {
435  if (empty($type) || empty($object_ref)) {
436  throw new RestException(401);
437  }
438 
439  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
440  throw new RestException(401);
441  }
442 
443  $result = $this->category->fetch($id);
444  if (!$result) {
445  throw new RestException(404, 'category not found');
446  }
447 
448  if ($type === Categorie::TYPE_PRODUCT) {
449  if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
450  throw new RestException(401);
451  }
452  $object = new Product($this->db);
453  } elseif ($type === Categorie::TYPE_CUSTOMER) {
454  if (!DolibarrApiAccess::$user->rights->societe->creer) {
455  throw new RestException(401);
456  }
457  $object = new Societe($this->db);
458  } elseif ($type === Categorie::TYPE_SUPPLIER) {
459  if (!DolibarrApiAccess::$user->rights->societe->creer) {
460  throw new RestException(401);
461  }
462  $object = new Societe($this->db);
463  } elseif ($type === Categorie::TYPE_CONTACT) {
464  if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
465  throw new RestException(401);
466  }
467  $object = new Contact($this->db);
468  } elseif ($type === Categorie::TYPE_MEMBER) {
469  if (!DolibarrApiAccess::$user->rights->adherent->creer) {
470  throw new RestException(401);
471  }
472  $object = new Adherent($this->db);
473  } else {
474  throw new RestException(401, "this type is not recognized yet.");
475  }
476 
477  if (!empty($object)) {
478  $result = $object->fetch('', $object_ref);
479  if ($result > 0) {
480  $result = $this->category->add_type($object, $type);
481  if ($result < 0) {
482  if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') {
483  throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors));
484  }
485  }
486  } else {
487  throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
488  }
489 
490  return array(
491  'success' => array(
492  'code' => 200,
493  'message' => 'Objects succefully linked to the category'
494  )
495  );
496  }
497 
498  throw new RestException(401);
499  }
500 
513  public function unlinkObjectById($id, $type, $object_id)
514  {
515  if (empty($type) || empty($object_id)) {
516  throw new RestException(401);
517  }
518 
519  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
520  throw new RestException(401);
521  }
522 
523  $result = $this->category->fetch($id);
524  if (!$result) {
525  throw new RestException(404, 'category not found');
526  }
527 
528  if ($type === Categorie::TYPE_PRODUCT) {
529  if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
530  throw new RestException(401);
531  }
532  $object = new Product($this->db);
533  } elseif ($type === Categorie::TYPE_CUSTOMER) {
534  if (!DolibarrApiAccess::$user->rights->societe->creer) {
535  throw new RestException(401);
536  }
537  $object = new Societe($this->db);
538  } elseif ($type === Categorie::TYPE_SUPPLIER) {
539  if (!DolibarrApiAccess::$user->rights->societe->creer) {
540  throw new RestException(401);
541  }
542  $object = new Societe($this->db);
543  } elseif ($type === Categorie::TYPE_CONTACT) {
544  if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
545  throw new RestException(401);
546  }
547  $object = new Contact($this->db);
548  } elseif ($type === Categorie::TYPE_MEMBER) {
549  if (!DolibarrApiAccess::$user->rights->adherent->creer) {
550  throw new RestException(401);
551  }
552  $object = new Adherent($this->db);
553  } else {
554  throw new RestException(401, "this type is not recognized yet.");
555  }
556 
557  if (!empty($object)) {
558  $result = $object->fetch((int) $object_id);
559  if ($result > 0) {
560  $result = $this->category->del_type($object, $type);
561  if ($result < 0) {
562  throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
563  }
564  } else {
565  throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
566  }
567 
568  return array(
569  'success' => array(
570  'code' => 200,
571  'message' => 'Objects succefully unlinked from the category'
572  )
573  );
574  }
575 
576  throw new RestException(401);
577  }
578 
591  public function unlinkObjectByRef($id, $type, $object_ref)
592  {
593  if (empty($type) || empty($object_ref)) {
594  throw new RestException(401);
595  }
596 
597  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
598  throw new RestException(401);
599  }
600 
601  $result = $this->category->fetch($id);
602  if (!$result) {
603  throw new RestException(404, 'category not found');
604  }
605 
606  if ($type === Categorie::TYPE_PRODUCT) {
607  if (!(DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) {
608  throw new RestException(401);
609  }
610  $object = new Product($this->db);
611  } elseif ($type === Categorie::TYPE_CUSTOMER) {
612  if (!DolibarrApiAccess::$user->rights->societe->creer) {
613  throw new RestException(401);
614  }
615  $object = new Societe($this->db);
616  } elseif ($type === Categorie::TYPE_SUPPLIER) {
617  if (!DolibarrApiAccess::$user->rights->societe->creer) {
618  throw new RestException(401);
619  }
620  $object = new Societe($this->db);
621  } elseif ($type === Categorie::TYPE_CONTACT) {
622  if (!DolibarrApiAccess::$user->rights->societe->contact->creer) {
623  throw new RestException(401);
624  }
625  $object = new Contact($this->db);
626  } elseif ($type === Categorie::TYPE_MEMBER) {
627  if (!DolibarrApiAccess::$user->rights->adherent->creer) {
628  throw new RestException(401);
629  }
630  $object = new Adherent($this->db);
631  } else {
632  throw new RestException(401, "this type is not recognized yet.");
633  }
634 
635  if (!empty($object)) {
636  $result = $object->fetch('', (string) $object_ref);
637  if ($result > 0) {
638  $result = $this->category->del_type($object, $type);
639  if ($result < 0) {
640  throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors));
641  }
642  } else {
643  throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors));
644  }
645 
646  return array(
647  'success' => array(
648  'code' => 200,
649  'message' => 'Objects succefully unlinked from the category'
650  )
651  );
652  }
653 
654  throw new RestException(401);
655  }
656 
657 
658  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
665  protected function _cleanObjectDatas($object)
666  {
667  // phpcs:enable
668  $object = parent::_cleanObjectDatas($object);
669 
670  // Remove fields not relevent to categories
671  unset($object->MAP_CAT_FK);
672  unset($object->MAP_CAT_TABLE);
673  unset($object->MAP_OBJ_CLASS);
674  unset($object->MAP_OBJ_TABLE);
675  unset($object->country);
676  unset($object->country_id);
677  unset($object->country_code);
678  unset($object->total_ht);
679  unset($object->total_ht);
680  unset($object->total_localtax1);
681  unset($object->total_localtax2);
682  unset($object->total_ttc);
683  unset($object->total_tva);
684  unset($object->lines);
685  unset($object->fk_incoterms);
686  unset($object->label_incoterms);
687  unset($object->location_incoterms);
688  unset($object->civility_id);
689  unset($object->name);
690  unset($object->lastname);
691  unset($object->firstname);
692  unset($object->shipping_method_id);
693  unset($object->fk_delivery_address);
694  unset($object->cond_reglement);
695  unset($object->cond_reglement_id);
696  unset($object->mode_reglement_id);
697  unset($object->barcode_type_coder);
698  unset($object->barcode_type_label);
699  unset($object->barcode_type_code);
700  unset($object->barcode_type);
701  unset($object->canvas);
702  unset($object->cats);
703  unset($object->motherof);
704  unset($object->context);
705  unset($object->socid);
706  unset($object->thirdparty);
707  unset($object->contact);
708  unset($object->contact_id);
709  unset($object->user);
710  unset($object->fk_account);
711  unset($object->fk_project);
712  unset($object->note);
713  unset($object->statut);
714 
715  return $object;
716  }
717 
726  private function _validate($data)
727  {
728  $category = array();
729  foreach (Categories::$FIELDS as $field) {
730  if (!isset($data[$field])) {
731  throw new RestException(400, "$field field missing");
732  }
733  $category[$field] = $data[$field];
734  }
735  return $category;
736  }
737 
749  public function getObjects($id, $type, $onlyids = 0)
750  {
751  dol_syslog("getObjects($id, $type, $onlyids)", LOG_DEBUG);
752 
753  if (!DolibarrApiAccess::$user->rights->categorie->lire) {
754  throw new RestException(401);
755  }
756 
757  if (empty($type)) {
758  throw new RestException(500, 'The "type" parameter is required.');
759  }
760 
761  $result = $this->category->fetch($id);
762  if (!$result) {
763  throw new RestException(404, 'category not found');
764  }
765 
766  if (!DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) {
767  throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
768  }
769 
770  $result = $this->category->getObjectsInCateg($type, $onlyids);
771 
772  if ($result < 0) {
773  throw new RestException(503, 'Error when retrieving objects list : '.$this->category->error);
774  }
775 
776  $objects = $result;
777  $cleaned_objects = array();
778  $objects_api = null;
779  if ($type == 'member') {
780  $objects_api = new Members();
781  } elseif ($type == 'customer' || $type == 'supplier') {
782  $objects_api = new Thirdparties();
783  } elseif ($type == 'product') {
784  $objects_api = new Products();
785  } elseif ($type == 'contact') {
786  $objects_api = new Contacts();
787  } elseif ($type == 'project') {
788  $objects_api = new Projects();
789  }
790  if (is_object($objects_api)) {
791  foreach ($objects as $obj) {
792  $cleaned_objects[] = $objects_api->_cleanObjectDatas($obj);
793  }
794  }
795 
796  return $cleaned_objects;
797  }
798 }
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
db
$conf db
API class for accounts.
Definition: inc.php:41
Members
Definition: api_members.class.php:34
DolibarrApi\_checkAccessToResource
static _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
Check access by user to a given resource.
Definition: api.class.php:283
Categorie
Class to manage categories.
Definition: categorie.class.php:47
Categories\_validate
_validate($data)
Validate fields before create or update object.
Definition: api_categories.class.php:726
Categories
Definition: api_categories.class.php:36
DolibarrApi
Class for API REST v1.
Definition: api.class.php:30
Categories\put
put($id, $request_data=null)
Update category.
Definition: api_categories.class.php:222
Categories\getListForObject
getListForObject($id, $type, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
List categories of an object.
Definition: api_categories.class.php:300
Categories\linkObjectByRef
linkObjectByRef($id, $type, $object_ref)
Link an object to a category by ref.
Definition: api_categories.class.php:433
DolibarrApi\_checkFilters
_checkFilters($sqlfilters, &$error='')
Return if a $sqlfilters parameter is valid.
Definition: api.class.php:310
Categories\post
post($request_data=null)
Create category object.
Definition: api_categories.class.php:197
Categories\index
index($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $type='', $sqlfilters='')
List categories.
Definition: api_categories.class.php:133
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1589
Contact
Class to manage contact/addresses.
Definition: contact.class.php:40
Contacts
Definition: api_contacts.class.php:31
Categories\unlinkObjectByRef
unlinkObjectByRef($id, $type, $object_ref)
Unlink an object from a category by ref.
Definition: api_categories.class.php:591
Adherent
Class to manage members of a foundation.
Definition: adherent.class.php:46
Categories\_cleanObjectDatas
_cleanObjectDatas($object)
Clean sensible object datas.
Definition: api_categories.class.php:665
Product
Class to manage products or services.
Definition: product.class.php:46
Categories\unlinkObjectById
unlinkObjectById($id, $type, $object_id)
Unlink an object from a category by id.
Definition: api_categories.class.php:513
Thirdparties
Definition: api_thirdparties.class.php:30
Categories\linkObjectById
linkObjectById($id, $type, $object_id)
Link an object to a category by id.
Definition: api_categories.class.php:353
Projects
Definition: api_projects.class.php:30
Categories\getObjects
getObjects($id, $type, $onlyids=0)
Get the list of objects in a category.
Definition: api_categories.class.php:749
Products
Definition: api_products.class.php:35
Categories\__construct
__construct()
Constructor.
Definition: api_categories.class.php:71