From f9e37412c694ff7ecf95bf75f3914aad74b8ad77 Mon Sep 17 00:00:00 2001 From: pascal Date: Thu, 3 Aug 2023 09:32:43 +0200 Subject: [PATCH 1/3] Add filter to restric properties returned --- htdocs/commande/class/api_orders.class.php | 112 ++++++++++++--------- 1 file changed, 62 insertions(+), 50 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index b82bd618a42..ea49723ee26 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -18,7 +18,7 @@ use Luracast\Restler\RestException; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; /** * API class for orders @@ -128,7 +128,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } // Add external contacts ids @@ -139,7 +139,7 @@ class Orders extends DolibarrApi $this->commande->fetchObjectLinked(); // Add online_payment_url, cf #20477 - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); return $this->_cleanObjectDatas($this->commande); @@ -156,12 +156,13 @@ class Orders extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException 404 Not found * @throws RestException 503 Error */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -184,32 +185,32 @@ class Orders extends DolibarrApi if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql .= " FROM ".MAIN_DB_PREFIX."commande AS t LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields + $sql .= " FROM " . MAIN_DB_PREFIX . "commande AS t LEFT JOIN " . MAIN_DB_PREFIX . "commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale } - $sql .= ' WHERE t.entity IN ('.getEntity('commande').')'; + $sql .= ' WHERE t.entity IN (' . getEntity('commande') . ')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($socids) { - $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")"; + $sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socids) . ")"; } if ($search_sale > 0) { $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".((int) $search_sale); + $sql .= " AND sc.fk_user = " . ((int) $search_sale); } // Add sql filters if ($sqlfilters) { $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage); } } @@ -240,15 +241,15 @@ class Orders extends DolibarrApi $commande_static->contacts_ids = $tmparray; } // Add online_payment_url, cf #20477 - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; $commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref); - $obj_ret[] = $this->_cleanObjectDatas($commande_static); + $obj_ret[] = $this->_cleanObjectDatas($commande_static, $properties); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list : '.$this->db->lasterror()); + throw new RestException(503, 'Error when retrieve commande list : ' . $this->db->lasterror()); } if (!count($obj_ret)) { throw new RestException(404, 'No order found'); @@ -311,7 +312,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $this->commande->getLinesArray(); $result = array(); @@ -343,7 +344,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -410,7 +411,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -478,7 +479,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user, $lineid, $id); @@ -514,7 +515,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $contacts = $this->commande->liste_contact(-1, 'external', 0, $type); @@ -547,7 +548,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->commande->add_contact($contactid, $type, 'external'); @@ -595,10 +596,10 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } - $contacts = $this->commande->liste_contact(); + $contacts = $this->commande->liste_contact(); foreach ($contacts as $contact) { if ($contact['id'] == $contactid && $contact['code'] == $type) { @@ -637,7 +638,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) { if ($field == 'id') { @@ -677,11 +678,11 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - 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->commande->delete(DolibarrApiAccess::$user)) { - throw new RestException(500, 'Error when deleting order : '.$this->commande->error); + throw new RestException(500, 'Error when deleting order : ' . $this->commande->error); } return array( @@ -727,7 +728,7 @@ class Orders extends DolibarrApi $result = $this->commande->fetch_thirdparty(); // do not check result, as failure is not fatal (used only for mail notification substitutes) if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); @@ -735,14 +736,14 @@ class Orders extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Order: '.$this->commande->error); + throw new RestException(500, 'Error when validating Order: ' . $this->commande->error); } $result = $this->commande->fetch($id); $this->commande->fetchObjectLinked(); //fix #20477 : add online_payment_url - require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); return $this->_cleanObjectDatas($this->commande); @@ -826,7 +827,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -854,7 +855,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->commande->cloture(DolibarrApiAccess::$user, $notrigger); @@ -862,7 +863,7 @@ class Orders extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Order: '.$this->commande->error); + throw new RestException(500, 'Error when closing Order: ' . $this->commande->error); } $result = $this->commande->fetch($id); @@ -871,7 +872,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -899,7 +900,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $result = $this->commande->setDraft(DolibarrApiAccess::$user, $idwarehouse); @@ -907,7 +908,7 @@ class Orders extends DolibarrApi throw new RestException(304, 'Nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Order: '.$this->commande->error); + throw new RestException(500, 'Error when closing Order: ' . $this->commande->error); } $result = $this->commande->fetch($id); @@ -916,7 +917,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -941,7 +942,7 @@ class Orders extends DolibarrApi public function createOrderFromProposal($proposalid) { - require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) { throw new RestException(401); @@ -983,20 +984,20 @@ class Orders extends DolibarrApi */ public function getOrderShipments($id) { - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; if (!DolibarrApiAccess::$user->rights->expedition->lire) { throw new RestException(401); } $obj_ret = array(); $sql = "SELECT e.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; - $sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet"; + $sql .= " FROM " . MAIN_DB_PREFIX . "expedition as e"; + $sql .= " JOIN " . MAIN_DB_PREFIX . "expeditiondet as edet"; $sql .= " ON e.rowid = edet.fk_expedition"; - $sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cdet"; + $sql .= " JOIN " . MAIN_DB_PREFIX . "commandedet as cdet"; $sql .= " ON edet.fk_origin_line = cdet.rowid"; - $sql .= " JOIN ".MAIN_DB_PREFIX."commande as c"; + $sql .= " JOIN " . MAIN_DB_PREFIX . "commande as c"; $sql .= " ON cdet.fk_commande = c.rowid"; - $sql .= " WHERE c.rowid = ".((int) $id); + $sql .= " WHERE c.rowid = " . ((int) $id); $sql .= " GROUP BY e.rowid"; $sql .= $this->db->order("e.rowid", "ASC"); @@ -1018,7 +1019,7 @@ class Orders extends DolibarrApi $i++; } } else { - throw new RestException(500, 'Error when retrieve shipment list : '.$this->db->lasterror()); + throw new RestException(500, 'Error when retrieve shipment list : ' . $this->db->lasterror()); } return $obj_ret; } @@ -1039,7 +1040,7 @@ class Orders extends DolibarrApi */ public function createOrderShipment($id, $warehouse_id) { - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; + require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; if (!DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -1055,12 +1056,12 @@ class Orders extends DolibarrApi $shipment->origin_id = $this->commande->id; $result = $shipment->create(DolibarrApiAccess::$user); if ($result <= 0) { - throw new RestException(500, 'Error on creating expedition :'.$this->db->lasterror()); + throw new RestException(500, 'Error on creating expedition :' . $this->db->lasterror()); } foreach ($this->commande->lines as $line) { $result = $shipment->create_line($warehouse_id, $line->id, $line->qty); if ($result <= 0) { - throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror()); + throw new RestException(500, 'Error on creating expedition lines:' . $this->db->lasterror()); } } return $shipment->id; @@ -1070,10 +1071,11 @@ class Orders extends DolibarrApi /** * Clean sensible object datas * - * @param Object $object Object to clean - * @return Object Object with cleaned properties + * @param Object $object Object to clean + * @param String $properties If not empty, this will be the only properties returned. + * @return Object Object with cleaned properties */ - protected function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object, $properties = '') { // phpcs:enable $object = parent::_cleanObjectDatas($object); @@ -1085,7 +1087,17 @@ class Orders extends DolibarrApi unset($object->barcode_type_label); unset($object->barcode_type_coder); - return $object; + // If we + if (!empty($properties)) { + $newobject = new stdClass(); + $newobject->id = $object->id; + foreach (explode(',', $properties) as $property) { + $newobject->{$property} = $object->{$property}; + } + return $newobject; + } else { + return $object; + } } /** @@ -1100,7 +1112,7 @@ class Orders extends DolibarrApi $commande = array(); foreach (Orders::$FIELDS as $field) { if (!isset($data[$field])) { - throw new RestException(400, $field." field missing"); + throw new RestException(400, $field . " field missing"); } $commande[$field] = $data[$field]; } From 871f8969627a79faacc433f1c9f3ab345442b244 Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 26 Sep 2023 18:04:48 +0200 Subject: [PATCH 2/3] implementation of properties filter --- htdocs/adherents/class/api_members.class.php | 5 +- .../class/api_memberstypes.class.php | 5 +- .../class/api_subscriptions.class.php | 5 +- htdocs/api/class/api.class.php | 23 ++++ htdocs/bom/class/api_boms.class.php | 5 +- .../categories/class/api_categories.class.php | 5 +- .../action/class/api_agendaevents.class.php | 5 +- .../comm/propal/class/api_proposals.class.php | 5 +- htdocs/commande/class/api_orders.class.php | 110 ++++++++---------- .../bank/class/api_bankaccounts.class.php | 5 +- .../facture/class/api_invoices.class.php | 5 +- htdocs/contrat/class/api_contracts.class.php | 5 +- htdocs/don/class/api_donations.class.php | 5 +- .../expedition/class/api_shipments.class.php | 5 +- .../class/api_expensereports.class.php | 5 +- .../class/api_interventions.class.php | 5 +- .../class/api_supplier_invoices.class.php | 5 +- .../fourn/class/api_supplier_orders.class.php | 5 +- .../class/api_knowledgemanagement.class.php | 7 +- .../template/class/api_mymodule.class.php | 5 +- htdocs/mrp/class/api_mos.class.php | 9 +- .../class/api_multicurrencies.class.php | 5 +- .../class/api_partnership.class.php | 5 +- htdocs/product/class/api_products.class.php | 10 +- .../stock/class/api_stockmovements.class.php | 5 +- .../stock/class/api_warehouses.class.php | 5 +- htdocs/projet/class/api_projects.class.php | 5 +- htdocs/projet/class/api_tasks.class.php | 5 +- .../reception/class/api_receptions.class.php | 5 +- .../class/api_recruitment.class.php | 5 +- htdocs/societe/class/api_contacts.class.php | 5 +- .../societe/class/api_thirdparties.class.php | 5 +- .../class/api_supplier_proposals.class.php | 5 +- htdocs/ticket/class/api_tickets.class.php | 5 +- htdocs/user/class/api_users.class.php | 10 +- htdocs/zapier/class/api_zapier.class.php | 5 +- 36 files changed, 184 insertions(+), 135 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 8a26cd5d070..f160e9f4cbb 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -207,11 +207,12 @@ class Members extends DolibarrApi * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. * Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of member objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -263,7 +264,7 @@ class Members extends DolibarrApi $obj = $this->db->fetch_object($result); $member = new Adherent($this->db); if ($member->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($member); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($member), $properties); } $i++; } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index da43514a1d0..e19a5bcacb4 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -82,11 +82,12 @@ class MembersTypes extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of member type objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -128,7 +129,7 @@ class MembersTypes extends DolibarrApi $obj = $this->db->fetch_object($result); $membertype = new AdherentType($this->db); if ($membertype->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($membertype); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($membertype), $properties); } $i++; } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index a60078769a0..643eccdf55a 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -81,11 +81,12 @@ class Subscriptions extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of subscription objects * * @throws RestException */ - public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $conf; @@ -125,7 +126,7 @@ class Subscriptions extends DolibarrApi $obj = $this->db->fetch_object($result); $subscription = new Subscription($this->db); if ($subscription->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($subscription); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($subscription), $properties); } $i++; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 672923eb20f..40d2b3db798 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -93,6 +93,29 @@ class DolibarrApi } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Filter properties that will be returned on object + * + * @param Object $object Object to clean + * @param String $properties Comma separated list of properties names + * @return Object Object with cleaned properties + */ + protected function _filterObjectProperties($object, $properties) + { + // If properties is empty, we return all properties + if (empty($properties)) { + return $object; + } + // Else we filter properties + foreach (get_object_vars($object) as $key => $value) { + if (!in_array($key, explode(',', $properties))) { + unset($object->$key); + } + } + return $object; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 52e6fe90501..0a13a78e04f 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -92,11 +92,12 @@ class Boms extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -174,7 +175,7 @@ class Boms extends DolibarrApi $obj = $this->db->fetch_object($result); $bom_static = new BOM($this->db); if ($bom_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($bom_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($bom_static), $properties); } $i++; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 5b82bcd6d2c..22e72f09832 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -126,11 +126,12 @@ class Categories extends DolibarrApi * @param int $page Page number * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of category objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -174,7 +175,7 @@ class Categories extends DolibarrApi $obj = $this->db->fetch_object($result); $category_static = new Categorie($this->db); if ($category_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($category_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($category_static), $properties); } $i++; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 179145c4be4..9c0d6e2036c 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -101,9 +101,10 @@ class AgendaEvents extends DolibarrApi * @param int $page Page number * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of Agenda Events objects */ - public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -185,7 +186,7 @@ class AgendaEvents extends DolibarrApi $obj = $this->db->fetch_object($result); $actioncomm_static = new ActionComm($this->db); if ($actioncomm_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($actioncomm_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($actioncomm_static), $properties); } $i++; } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index fd0b4c0cdb6..dceb1bd8c9f 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -156,9 +156,10 @@ class Proposals extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter commercial proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -237,7 +238,7 @@ class Proposals extends DolibarrApi if (is_array($tmparray)) { $proposal_static->contacts_ids = $tmparray; } - $obj_ret[] = $this->_cleanObjectDatas($proposal_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($proposal_static), $properties); } $i++; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index ea49723ee26..0c0ee3133e4 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -18,7 +18,7 @@ use Luracast\Restler\RestException; -require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; /** * API class for orders @@ -128,7 +128,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } // Add external contacts ids @@ -139,7 +139,7 @@ class Orders extends DolibarrApi $this->commande->fetchObjectLinked(); // Add online_payment_url, cf #20477 - require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); return $this->_cleanObjectDatas($this->commande); @@ -156,7 +156,7 @@ class Orders extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException 404 Not found @@ -185,32 +185,32 @@ class Orders extends DolibarrApi if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql .= " FROM " . MAIN_DB_PREFIX . "commande AS t LEFT JOIN " . MAIN_DB_PREFIX . "commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields + $sql .= " FROM ".MAIN_DB_PREFIX."commande AS t LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale } - $sql .= ' WHERE t.entity IN (' . getEntity('commande') . ')'; + $sql .= ' WHERE t.entity IN ('.getEntity('commande').')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($socids) { - $sql .= " AND t.fk_soc IN (" . $this->db->sanitize($socids) . ")"; + $sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")"; } if ($search_sale > 0) { $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = " . ((int) $search_sale); + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } } @@ -241,15 +241,15 @@ class Orders extends DolibarrApi $commande_static->contacts_ids = $tmparray; } // Add online_payment_url, cf #20477 - require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref); - $obj_ret[] = $this->_cleanObjectDatas($commande_static, $properties); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($commande_static), $properties); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list : ' . $this->db->lasterror()); + throw new RestException(503, 'Error when retrieve commande list : '.$this->db->lasterror()); } if (!count($obj_ret)) { throw new RestException(404, 'No order found'); @@ -312,7 +312,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->commande->getLinesArray(); $result = array(); @@ -344,7 +344,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -411,7 +411,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -479,7 +479,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user, $lineid, $id); @@ -515,7 +515,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $contacts = $this->commande->liste_contact(-1, 'external', 0, $type); @@ -548,7 +548,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $result = $this->commande->add_contact($contactid, $type, 'external'); @@ -596,10 +596,10 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $contacts = $this->commande->liste_contact(); + $contacts = $this->commande->liste_contact(); foreach ($contacts as $contact) { if ($contact['id'] == $contactid && $contact['code'] == $type) { @@ -638,7 +638,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) { if ($field == 'id') { @@ -678,11 +678,11 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - 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->commande->delete(DolibarrApiAccess::$user)) { - throw new RestException(500, 'Error when deleting order : ' . $this->commande->error); + throw new RestException(500, 'Error when deleting order : '.$this->commande->error); } return array( @@ -728,7 +728,7 @@ class Orders extends DolibarrApi $result = $this->commande->fetch_thirdparty(); // do not check result, as failure is not fatal (used only for mail notification substitutes) if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); @@ -736,14 +736,14 @@ class Orders extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Order: ' . $this->commande->error); + throw new RestException(500, 'Error when validating Order: '.$this->commande->error); } $result = $this->commande->fetch($id); $this->commande->fetchObjectLinked(); //fix #20477 : add online_payment_url - require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref); return $this->_cleanObjectDatas($this->commande); @@ -827,7 +827,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -855,7 +855,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $result = $this->commande->cloture(DolibarrApiAccess::$user, $notrigger); @@ -863,7 +863,7 @@ class Orders extends DolibarrApi throw new RestException(304, 'Error nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Order: ' . $this->commande->error); + throw new RestException(500, 'Error when closing Order: '.$this->commande->error); } $result = $this->commande->fetch($id); @@ -872,7 +872,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -900,7 +900,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $result = $this->commande->setDraft(DolibarrApiAccess::$user, $idwarehouse); @@ -908,7 +908,7 @@ class Orders extends DolibarrApi throw new RestException(304, 'Nothing done. May be object is already closed'); } if ($result < 0) { - throw new RestException(500, 'Error when closing Order: ' . $this->commande->error); + throw new RestException(500, 'Error when closing Order: '.$this->commande->error); } $result = $this->commande->fetch($id); @@ -917,7 +917,7 @@ class Orders extends DolibarrApi } if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login); + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->commande->fetchObjectLinked(); @@ -942,7 +942,7 @@ class Orders extends DolibarrApi public function createOrderFromProposal($proposalid) { - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) { throw new RestException(401); @@ -984,20 +984,20 @@ class Orders extends DolibarrApi */ public function getOrderShipments($id) { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; if (!DolibarrApiAccess::$user->rights->expedition->lire) { throw new RestException(401); } $obj_ret = array(); $sql = "SELECT e.rowid"; - $sql .= " FROM " . MAIN_DB_PREFIX . "expedition as e"; - $sql .= " JOIN " . MAIN_DB_PREFIX . "expeditiondet as edet"; + $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; + $sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet"; $sql .= " ON e.rowid = edet.fk_expedition"; - $sql .= " JOIN " . MAIN_DB_PREFIX . "commandedet as cdet"; + $sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cdet"; $sql .= " ON edet.fk_origin_line = cdet.rowid"; - $sql .= " JOIN " . MAIN_DB_PREFIX . "commande as c"; + $sql .= " JOIN ".MAIN_DB_PREFIX."commande as c"; $sql .= " ON cdet.fk_commande = c.rowid"; - $sql .= " WHERE c.rowid = " . ((int) $id); + $sql .= " WHERE c.rowid = ".((int) $id); $sql .= " GROUP BY e.rowid"; $sql .= $this->db->order("e.rowid", "ASC"); @@ -1019,7 +1019,7 @@ class Orders extends DolibarrApi $i++; } } else { - throw new RestException(500, 'Error when retrieve shipment list : ' . $this->db->lasterror()); + throw new RestException(500, 'Error when retrieve shipment list : '.$this->db->lasterror()); } return $obj_ret; } @@ -1040,7 +1040,7 @@ class Orders extends DolibarrApi */ public function createOrderShipment($id, $warehouse_id) { - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; if (!DolibarrApiAccess::$user->rights->expedition->creer) { throw new RestException(401); } @@ -1056,12 +1056,12 @@ class Orders extends DolibarrApi $shipment->origin_id = $this->commande->id; $result = $shipment->create(DolibarrApiAccess::$user); if ($result <= 0) { - throw new RestException(500, 'Error on creating expedition :' . $this->db->lasterror()); + throw new RestException(500, 'Error on creating expedition :'.$this->db->lasterror()); } foreach ($this->commande->lines as $line) { $result = $shipment->create_line($warehouse_id, $line->id, $line->qty); if ($result <= 0) { - throw new RestException(500, 'Error on creating expedition lines:' . $this->db->lasterror()); + throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror()); } } return $shipment->id; @@ -1072,10 +1072,9 @@ class Orders extends DolibarrApi * Clean sensible object datas * * @param Object $object Object to clean - * @param String $properties If not empty, this will be the only properties returned. - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties */ - protected function _cleanObjectDatas($object, $properties = '') + protected function _cleanObjectDatas($object) { // phpcs:enable $object = parent::_cleanObjectDatas($object); @@ -1087,17 +1086,7 @@ class Orders extends DolibarrApi unset($object->barcode_type_label); unset($object->barcode_type_coder); - // If we - if (!empty($properties)) { - $newobject = new stdClass(); - $newobject->id = $object->id; - foreach (explode(',', $properties) as $property) { - $newobject->{$property} = $object->{$property}; - } - return $newobject; - } else { - return $object; - } + return $object; } /** @@ -1112,10 +1101,11 @@ class Orders extends DolibarrApi $commande = array(); foreach (Orders::$FIELDS as $field) { if (!isset($data[$field])) { - throw new RestException(400, $field . " field missing"); + throw new RestException(400, $field." field missing"); } $commande[$field] = $data[$field]; } return $commande; } } + diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index e81981a7490..2cecead3371 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -58,11 +58,12 @@ class BankAccounts extends DolibarrApi * @param int $page Page number * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array List of account objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '', $properties = '') { $list = array(); @@ -108,7 +109,7 @@ class BankAccounts extends DolibarrApi $obj = $this->db->fetch_object($result); $account = new Account($this->db); if ($account->fetch($obj->rowid) > 0) { - $list[] = $this->_cleanObjectDatas($account); + $list[] = $this->_filterObjectProperties($this->_cleanObjectDatas($account), $properties); } } } else { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d48740ea68d..46ec4256a24 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -171,12 +171,13 @@ class Invoices extends DolibarrApi * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of invoice objects * * @throws RestException 404 Not found * @throws RestException 503 Error */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -273,7 +274,7 @@ class Invoices extends DolibarrApi if (is_array($tmparray)) { $invoice_static->contacts_ids = $tmparray; } - $obj_ret[] = $this->_cleanObjectDatas($invoice_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($invoice_static), $properties); } $i++; } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index d8c44316bd5..8876f60bc65 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -96,12 +96,13 @@ class Contracts extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter contracts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of contract objects * * @throws RestException 404 Not found * @throws RestException 503 Error */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -174,7 +175,7 @@ class Contracts extends DolibarrApi $obj = $this->db->fetch_object($result); $contrat_static = new Contrat($this->db); if ($contrat_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($contrat_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($contrat_static), $properties); } $i++; } diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 7c78275e913..18bcab15ba4 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -95,11 +95,12 @@ class Donations extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -158,7 +159,7 @@ class Donations extends DolibarrApi if ($don_static->fetch($obj->rowid)) { // Add external contacts ids //$don_static->contacts_ids = $don_static->liste_contact(-1, 'external', 1); - $obj_ret[] = $this->_cleanObjectDatas($don_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($don_static), $properties); } $i++; } diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 3297b70cd93..9894cacebde 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -95,11 +95,12 @@ class Shipments extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter shipments of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of shipment objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -172,7 +173,7 @@ class Shipments extends DolibarrApi $obj = $this->db->fetch_object($result); $shipment_static = new Expedition($this->db); if ($shipment_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($shipment_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($shipment_static), $properties); } $i++; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 1a3955f11d6..2dee9a13b73 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -93,9 +93,10 @@ class ExpenseReports extends DolibarrApi * @param int $page Page number * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of Expense Report objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -144,7 +145,7 @@ class ExpenseReports extends DolibarrApi $obj = $this->db->fetch_object($result); $expensereport_static = new ExpenseReport($this->db); if ($expensereport_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($expensereport_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($expensereport_static), $properties); } $i++; } diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 79f8991dc09..32a9d59132f 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -106,11 +106,12 @@ class Interventions extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -183,7 +184,7 @@ class Interventions extends DolibarrApi $obj = $this->db->fetch_object($result); $fichinter_static = new Fichinter($this->db); if ($fichinter_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($fichinter_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($fichinter_static), $properties); } $i++; } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index a531667d0e5..98cca7c95fa 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -94,11 +94,12 @@ class SupplierInvoices extends DolibarrApi * @param string $thirdparty_ids Thirdparty ids to filter invoices of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of invoice objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '', $properties = '') { global $db; @@ -185,7 +186,7 @@ class SupplierInvoices extends DolibarrApi $obj = $this->db->fetch_object($result); $invoice_static = new FactureFournisseur($this->db); if ($invoice_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($invoice_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($invoice_static), $properties); } $i++; } diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 503bd908a2d..c790472392a 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -93,11 +93,12 @@ class SupplierOrders extends DolibarrApi * @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $product_ids = '', $status = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -201,7 +202,7 @@ class SupplierOrders extends DolibarrApi $obj = $this->db->fetch_object($result); $order_static = new CommandeFournisseur($this->db); if ($order_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($order_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($order_static), $properties); } $i++; } diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 570d09a0cdd..7ecb878ee48 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -130,14 +130,15 @@ class KnowledgeManagement extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException * * @url GET /knowledgerecords/ */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -223,7 +224,7 @@ class KnowledgeManagement extends DolibarrApi $obj = $this->db->fetch_object($result); $tmp_object = new KnowledgeRecord($this->db); if ($tmp_object->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($tmp_object); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties); } $i++; } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 20daec19bd1..0034f102426 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -98,13 +98,14 @@ class MyModuleApi extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException * * @url GET /myobjects/ */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -182,7 +183,7 @@ class MyModuleApi extends DolibarrApi $obj = $this->db->fetch_object($result); $tmp_object = new MyObject($this->db); if ($tmp_object->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($tmp_object); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties); } $i++; } diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 9723d5b2070..ad21328995f 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -90,11 +90,12 @@ class Mos extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -172,7 +173,7 @@ class Mos extends DolibarrApi $obj = $this->db->fetch_object($result); $tmp_object = new Mo($this->db); if ($tmp_object->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($tmp_object); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties); } $i++; } @@ -647,8 +648,8 @@ class Mos extends DolibarrApi /** * Clean sensible object datas * - * @param Object $object Object to clean - * @return Object Object with cleaned properties + * @param Object $object Object to clean + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { diff --git a/htdocs/multicurrency/class/api_multicurrencies.class.php b/htdocs/multicurrency/class/api_multicurrencies.class.php index 99fc1c2bb95..c0323fb928a 100644 --- a/htdocs/multicurrency/class/api_multicurrencies.class.php +++ b/htdocs/multicurrency/class/api_multicurrencies.class.php @@ -47,11 +47,12 @@ class MultiCurrencies extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of warehouse objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $sqlfilters = '', $properties = '') { global $db; @@ -89,7 +90,7 @@ class MultiCurrencies extends DolibarrApi $obj = $this->db->fetch_object($result); $multicurrency_static = new MultiCurrency($this->db); if ($multicurrency_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($multicurrency_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($multicurrency_static), $properties); } $i++; } diff --git a/htdocs/partnership/class/api_partnership.class.php b/htdocs/partnership/class/api_partnership.class.php index 47e801cf662..742030e04e9 100644 --- a/htdocs/partnership/class/api_partnership.class.php +++ b/htdocs/partnership/class/api_partnership.class.php @@ -96,13 +96,14 @@ class PartnershipApi extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException * * @url GET /partnerships/ */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -180,7 +181,7 @@ class PartnershipApi extends DolibarrApi $obj = $this->db->fetch_object($result); $tmp_object = new Partnership($this->db); if ($tmp_object->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($tmp_object); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties); } $i++; } diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 1594cd3bd05..29825e9c05a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -173,9 +173,10 @@ class Products extends DolibarrApi * @param int $variant_filter Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0 * @param int $includestockdata Load also information about stock (slower) + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of product objects */ - public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0) + public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0, $properties = '') { global $db, $conf; @@ -266,7 +267,7 @@ class Products extends DolibarrApi } - $obj_ret[] = $this->_cleanObjectDatas($product_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($product_static), $properties); } } else { $obj_ret[] = $obj->rowid; @@ -1010,6 +1011,7 @@ class Products extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:color)" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array * * @throws RestException 401 @@ -1018,7 +1020,7 @@ class Products extends DolibarrApi * * @url GET attributes */ - public function getAttributes($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function getAttributes($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { if (!DolibarrApiAccess::$user->rights->produit->lire) { throw new RestException(401); @@ -1063,7 +1065,7 @@ class Products extends DolibarrApi $tmp->position = $obj->position; $tmp->entity = $obj->entity; - $return[] = $this->_cleanObjectDatas($tmp); + $return[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp), $properties); } if (!count($return)) { diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index c71d37bace1..f3de23631d1 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -89,11 +89,12 @@ class StockMovements extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of warehouse objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $conf; @@ -136,7 +137,7 @@ class StockMovements extends DolibarrApi $obj = $this->db->fetch_object($result); $stockmovement_static = new MouvementStock($this->db); if ($stockmovement_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($stockmovement_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($stockmovement_static), $properties); } $i++; } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 28ae1f25247..a2744897dc4 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -89,11 +89,12 @@ class Warehouses extends DolibarrApi * @param int $page Page number * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of warehouse objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -142,7 +143,7 @@ class Warehouses extends DolibarrApi $obj = $this->db->fetch_object($result); $warehouse_static = new Entrepot($this->db); if ($warehouse_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($warehouse_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($warehouse_static), $properties); } $i++; } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 91e22f4e054..89a01be3f4c 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -102,9 +102,10 @@ class Projects extends DolibarrApi * @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of project objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $properties = '') { if (!DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); @@ -182,7 +183,7 @@ class Projects extends DolibarrApi $obj = $this->db->fetch_object($result); $project_static = new Project($this->db); if ($project_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($project_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($project_static), $properties); } $i++; } diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 0320a13e5b2..157ff99fc33 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -102,9 +102,10 @@ class Tasks extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of project objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -177,7 +178,7 @@ class Tasks extends DolibarrApi $obj = $this->db->fetch_object($result); $task_static = new Task($this->db); if ($task_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($task_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($task_static), $properties); } $i++; } diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 49b65d5c5e4..415f856e29a 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -94,11 +94,12 @@ class Receptions extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter receptions of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of reception objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { global $db, $conf; @@ -171,7 +172,7 @@ class Receptions extends DolibarrApi $obj = $this->db->fetch_object($result); $reception_static = new Reception($this->db); if ($reception_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($reception_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($reception_static), $properties); } $i++; } diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php index 7b34a6abc31..be9def9324d 100644 --- a/htdocs/recruitment/class/api_recruitment.class.php +++ b/htdocs/recruitment/class/api_recruitment.class.php @@ -134,13 +134,14 @@ class Recruitment extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException * * @url GET /jobposition/ */ - public function indexJobPosition($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function indexJobPosition($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -218,7 +219,7 @@ class Recruitment extends DolibarrApi $obj = $this->db->fetch_object($result); $tmp_object = new RecruitmentJobPosition($this->db); if ($tmp_object->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($tmp_object); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties); } $i++; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 9aff444a242..0e01e9b4b58 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -166,11 +166,12 @@ class Contacts extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param int $includecount Count and return also number of elements the contact is used as a link for * @param int $includeroles Includes roles of the contact + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of contact objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includecount = 0, $includeroles = 0) + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includecount = 0, $includeroles = 0, $properties = '') { global $db, $conf; @@ -261,7 +262,7 @@ class Contacts extends DolibarrApi $contact_static->getNoEmail(); } - $obj_ret[] = $this->_cleanObjectDatas($contact_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($contact_static), $properties); } $i++; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 42d7e37a8aa..60d9030024f 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -126,9 +126,10 @@ class Thirdparties extends DolibarrApi * Set to 4 to show only suppliers * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "((t.nom:like:'TheCompany%') or (t.name_alias:like:'TheCompany%')) and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of thirdparty objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $properties = '') { $obj_ret = array(); @@ -233,7 +234,7 @@ class Thirdparties extends DolibarrApi if (isModEnabled('mailing')) { $soc_static->getNoEmail(); } - $obj_ret[] = $this->_cleanObjectDatas($soc_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($soc_static), $properties); } $i++; } diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 5052a41747b..92dbaf07c3f 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -92,9 +92,10 @@ class SupplierProposals extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter supplier proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') { if (!DolibarrApiAccess::$user->rights->supplier_proposal->lire) { throw new RestException(401); @@ -164,7 +165,7 @@ class SupplierProposals extends DolibarrApi $obj = $this->db->fetch_object($result); $propal_static = new SupplierProposal($this->db); if ($propal_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($propal_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($propal_static), $properties); } $i++; } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index fa2ae9597ae..4bf1116d018 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -194,11 +194,12 @@ class Tickets extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101') and (t.fk_statut:=:1)" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * * @return array Array of ticket objects * */ - public function index($socid = 0, $sortfield = "t.rowid", $sortorder = "ASC", $limit = 100, $page = 0, $sqlfilters = '') + public function index($socid = 0, $sortfield = "t.rowid", $sortorder = "ASC", $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -277,7 +278,7 @@ class Tickets extends DolibarrApi $userStatic->fetch($ticket_static->fk_user_assign); $ticket_static->fk_user_assign_string = $userStatic->firstname.' '.$userStatic->lastname; } - $obj_ret[] = $this->_cleanObjectDatas($ticket_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($ticket_static), $properties); } $i++; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 5090539814b..2dec0e96999 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -66,9 +66,10 @@ class Users extends DolibarrApi * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of User objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $category = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $category = 0, $sqlfilters = '', $properties = '') { global $conf; @@ -126,7 +127,7 @@ class Users extends DolibarrApi $obj = $this->db->fetch_object($result); $user_static = new User($this->db); if ($user_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($user_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($user_static), $properties); } $i++; } @@ -515,12 +516,13 @@ class Users extends DolibarrApi * @param int $page Page number * @param string $group_ids Groups ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of User objects * * @throws RestException 404 User not found * @throws RestException 503 Error */ - public function listGroups($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $group_ids = 0, $sqlfilters = '') + public function listGroups($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $group_ids = 0, $sqlfilters = '', $properties = '') { global $conf; @@ -569,7 +571,7 @@ class Users extends DolibarrApi $obj = $this->db->fetch_object($result); $group_static = new UserGroup($this->db); if ($group_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($group_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($group_static), $properties); } $i++; } diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 5ff155aebf0..bdfdaecf493 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -135,13 +135,14 @@ class Zapier extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException * * @url GET /hooks/ */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { global $db, $conf; @@ -222,7 +223,7 @@ class Zapier extends DolibarrApi $obj = $this->db->fetch_object($result); $hook_static = new Hook($this->db); if ($hook_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($hook_static); + $obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($hook_static), $properties); } $i++; } From 80f060c77177afddd035dce5ad426378ab809c50 Mon Sep 17 00:00:00 2001 From: pascal Date: Tue, 26 Sep 2023 18:43:25 +0200 Subject: [PATCH 3/3] fix tab indentation --- .../class/api_accountancy.class.php | 22 ++-- htdocs/adherents/class/api_members.class.php | 26 ++-- .../class/api_memberstypes.class.php | 4 +- .../class/api_subscriptions.class.php | 4 +- htdocs/bom/class/api_boms.class.php | 18 +-- .../categories/class/api_categories.class.php | 10 +- .../action/class/api_agendaevents.class.php | 8 +- .../comm/propal/class/api_proposals.class.php | 78 +++++------ htdocs/commande/class/api_orders.class.php | 55 ++++---- .../bank/class/api_bankaccounts.class.php | 22 ++-- .../facture/class/api_invoices.class.php | 122 +++++++++--------- htdocs/contrat/class/api_contracts.class.php | 34 ++--- htdocs/don/class/api_donations.class.php | 6 +- .../expedition/class/api_shipments.class.php | 16 +-- .../class/api_expensereports.class.php | 8 +- .../class/api_interventions.class.php | 24 ++-- .../class/api_supplier_invoices.class.php | 22 ++-- .../fourn/class/api_supplier_orders.class.php | 48 +++---- .../class/api_knowledgemanagement.class.php | 18 +-- .../template/class/api_mymodule.class.php | 14 +- htdocs/mrp/class/api_mos.class.php | 18 +-- .../class/api_multicurrencies.class.php | 28 ++-- .../class/api_partnership.class.php | 14 +- htdocs/product/class/api_products.class.php | 112 ++++++++-------- .../stock/class/api_stockmovements.class.php | 8 +- .../stock/class/api_warehouses.class.php | 8 +- htdocs/projet/class/api_projects.class.php | 16 +-- htdocs/projet/class/api_tasks.class.php | 16 +-- .../reception/class/api_receptions.class.php | 30 ++--- .../class/api_recruitment.class.php | 36 +++--- htdocs/societe/class/api_contacts.class.php | 28 ++-- .../societe/class/api_thirdparties.class.php | 56 ++++---- .../class/api_supplier_proposals.class.php | 14 +- htdocs/ticket/class/api_tickets.class.php | 28 ++-- htdocs/user/class/api_users.class.php | 40 +++--- htdocs/zapier/class/api_zapier.class.php | 6 +- 36 files changed, 508 insertions(+), 509 deletions(-) diff --git a/htdocs/accountancy/class/api_accountancy.class.php b/htdocs/accountancy/class/api_accountancy.class.php index f1870d7b8b2..815c7b69f05 100644 --- a/htdocs/accountancy/class/api_accountancy.class.php +++ b/htdocs/accountancy/class/api_accountancy.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2019 Cedric Ancelin - * Copyright (C) 2023 Lionel Vessiller + * Copyright (C) 2023 Lionel Vessiller * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,18 +64,18 @@ class Accountancy extends DolibarrApi /** * Accountancy export data * - * @param string $period Period : 'lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear' or 'custom' (see above) - * @param string $date_min [=''] Start date of period if 'custom' is set in period parameter - * Date format is 'YYYY-MM-DD' - * @param string $date_max [=''] End date of period if 'custom' is set in period parameter - * Date format is 'YYYY-MM-DD' - * @param string $format [=''] by default uses '1' for 'Configurable (CSV)' for format number + * @param string $period Period : 'lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear' or 'custom' (see above) + * @param string $date_min [=''] Start date of period if 'custom' is set in period parameter + * Date format is 'YYYY-MM-DD' + * @param string $date_max [=''] End date of period if 'custom' is set in period parameter + * Date format is 'YYYY-MM-DD' + * @param string $format [=''] by default uses '1' for 'Configurable (CSV)' for format number * or '1000' for FEC - * or '1010' for FEC2 - * (see AccountancyExport class) + * or '1010' for FEC2 + * (see AccountancyExport class) * @param int $lettering [=0] by default don't export or 1 to export lettering data (columns 'letterring_code' and 'date_lettering' returns empty or not) - * @param int $alreadyexport [=0] by default export data only if it's not yet exported or 1 already exported (always export data even if 'date_export" is set) - * @param int $notnotifiedasexport [=0] by default notified as exported or 1 not notified as exported (when the export is done, notified or not the column 'date_export') + * @param int $alreadyexport [=0] by default export data only if it's not yet exported or 1 already exported (always export data even if 'date_export" is set) + * @param int $notnotifiedasexport [=0] by default notified as exported or 1 not notified as exported (when the export is done, notified or not the column 'date_export') * * @return string * diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index f160e9f4cbb..f430e59f68d 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -55,8 +55,8 @@ class Members extends DolibarrApi * * Return an array with member informations * - * @param int $id ID of member - * @return Object Object with cleaned properties + * @param int $id ID of member + * @return Object Object with cleaned properties * * @throws RestException */ @@ -88,9 +88,9 @@ class Members extends DolibarrApi * * Return an array with member informations * - * @param int $thirdparty ID of third party + * @param int $thirdparty ID of third party * - * @return Object Data without useless information + * @return Object Data without useless information * * @url GET thirdparty/{thirdparty} * @@ -123,7 +123,7 @@ class Members extends DolibarrApi * * @param string $email Email of third party * - * @return Object Data without useless information + * @return Object Data without useless information * * @url GET thirdparty/email/{email} * @@ -160,9 +160,9 @@ class Members extends DolibarrApi * * Return an array with member informations * - * @param string $barcode Barcode of third party + * @param string $barcode Barcode of third party * - * @return Object Data without useless information + * @return Object Data without useless information * * @url GET thirdparty/barcode/{barcode} * @@ -204,7 +204,7 @@ class Members extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $typeid ID of the type of member - * @param int $category Use this param to filter list by category + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. * Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))" * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names @@ -484,11 +484,11 @@ class Members extends DolibarrApi /** * Add a subscription for a member * - * @param int $id ID of member - * @param string $start_date Start date {@from body} {@type timestamp} - * @param string $end_date End date {@from body} {@type timestamp} - * @param float $amount Amount (may be 0) {@from body} - * @param string $label Label {@from body} + * @param int $id ID of member + * @param string $start_date Start date {@from body} {@type timestamp} + * @param string $end_date End date {@from body} {@type timestamp} + * @param float $amount Amount (may be 0) {@from body} + * @param string $label Label {@from body} * @return int ID of subscription * * @url POST {id}/subscriptions diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index e19a5bcacb4..2ba5ce8fadf 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -48,8 +48,8 @@ class MembersTypes extends DolibarrApi * * Return an array with member type informations * - * @param int $id ID of member type - * @return Object Object with cleaned properties + * @param int $id ID of member type + * @return Object Object with cleaned properties * * @throws RestException */ diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 643eccdf55a..174de6d5fe9 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -51,8 +51,8 @@ class Subscriptions extends DolibarrApi * * Return an array with subscription informations * - * @param int $id ID of subscription - * @return Object Object with cleaned properties + * @param int $id ID of subscription + * @return Object Object with cleaned properties * * @throws RestException */ diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 0a13a78e04f..9b6912b6f8a 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -1,8 +1,8 @@ * Copyright (C) 2019 Maxime Kohlhaas - * Copyright (C) 2020 Frédéric France - * Copyright (C) 2022 Christian Humpel + * Copyright (C) 2020 Frédéric France + * Copyright (C) 2022 Christian Humpel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,11 +57,11 @@ class Boms extends DolibarrApi * * Return an array with bom informations * - * @param int $id ID of bom - * @return Object Object with cleaned properties + * @param int $id ID of bom + * @return Object Object with cleaned properties * * @url GET {id} - * @throws RestException + * @throws RestException */ public function get($id) { @@ -87,10 +87,10 @@ class Boms extends DolibarrApi * * Get a list of boms * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 22e72f09832..30e2ef7ff0e 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -80,11 +80,11 @@ class Categories extends DolibarrApi * * Return an array with category informations * - * @param int $id ID of category - * @param bool $include_childs Include child categories list (true or false) - * @return array|mixed data without useless information + * @param int $id ID of category + * @param bool $include_childs Include child categories list (true or false) + * @return array|mixed data without useless information * - * @throws RestException + * @throws RestException */ public function get($id, $include_childs = false) { @@ -126,7 +126,7 @@ class Categories extends DolibarrApi * @param int $page Page number * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of category objects * * @throws RestException diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 9c0d6e2036c..eef28e3516b 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -58,9 +58,9 @@ class AgendaEvents extends DolibarrApi * Return an array with Agenda Events informations * * @param int $id ID of Agenda Events - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -99,9 +99,9 @@ class AgendaEvents extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $user_ids User ids filter field (owners of event). Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'%dol%') and (t.datec:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of Agenda Events objects */ public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index dceb1bd8c9f..3f3e8b2301f 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -59,11 +59,11 @@ class Proposals extends DolibarrApi * * Return an array with commercial proposal informations * - * @param int $id ID of commercial proposal - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return Object Object with cleaned properties + * @param int $id ID of commercial proposal + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id, $contact_list = 1) { @@ -76,12 +76,12 @@ class Proposals extends DolibarrApi * Return an array with proposal informations * * @param string $ref Ref of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * * @url GET ref/{ref} * - * @throws RestException + * @throws RestException */ public function getByRef($ref, $contact_list = 1) { @@ -94,12 +94,12 @@ class Proposals extends DolibarrApi * Return an array with proposal informations * * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * * @url GET ref_ext/{ref_ext} * - * @throws RestException + * @throws RestException */ public function getByRefExt($ref_ext, $contact_list = 1) { @@ -114,10 +114,10 @@ class Proposals extends DolibarrApi * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1) { @@ -150,13 +150,13 @@ class Proposals extends DolibarrApi * * Get a list of commercial proposals * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter commercial proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter commercial proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '') @@ -286,7 +286,7 @@ class Proposals extends DolibarrApi * Get lines of a commercial proposal * * @param int $id Id of commercial proposal - * @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') AND (d.date_start:<:'20220101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') AND (d.date_start:<:'20220101')" * * @url GET {id}/lines * @@ -471,10 +471,10 @@ class Proposals extends DolibarrApi /** * Update a line of given commercial proposal * - * @param int $id Id of commercial proposal to update - * @param int $lineid Id of line to update - * @param array $request_data Commercial proposal line data - * @return Object|false Object with cleaned properties + * @param int $id Id of commercial proposal to update + * @param int $lineid Id of line to update + * @param array $request_data Commercial proposal line data + * @return Object|false Object with cleaned properties * * @url PUT {id}/lines/{lineid} */ @@ -547,9 +547,9 @@ class Proposals extends DolibarrApi * Delete a line of given commercial proposal * * - * @param int $id Id of commercial proposal to update - * @param int $lineid Id of line to delete - * @return Object|false Object with cleaned properties + * @param int $id Id of commercial proposal to update + * @param int $lineid Id of line to delete + * @return Object|false Object with cleaned properties * * @url DELETE {id}/lines/{lineid} * @@ -629,10 +629,10 @@ class Proposals extends DolibarrApi /** * Delete a contact type of given commercial proposal * - * @param int $id Id of commercial proposal to update - * @param int $contactid Row key of the contact in the array contact_ids. - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). - * @return Object Object with cleaned properties + * @param int $id Id of commercial proposal to update + * @param int $contactid Row key of the contact in the array contact_ids. + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). + * @return Object Object with cleaned properties * * @url DELETE {id}/contact/{contactid}/{type} * @@ -674,9 +674,9 @@ class Proposals extends DolibarrApi /** * Update commercial proposal general fields (won't touch lines of commercial proposal) * - * @param int $id Id of commercial proposal to update - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id Id of commercial proposal to update + * @param array $request_data Datas + * @return Object Object with cleaned properties */ public function put($id, $request_data = null) { @@ -752,7 +752,7 @@ class Proposals extends DolibarrApi * Set a proposal to draft * * @param int $id Order ID - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * * @url POST {id}/settodraft */ @@ -803,7 +803,7 @@ class Proposals extends DolibarrApi * * @param int $id Commercial proposal ID * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * * @url POST {id}/validate * @@ -852,10 +852,10 @@ class Proposals extends DolibarrApi * Close (Accept or refuse) a quote / commercial proposal * * @param int $id Commercial proposal ID - * @param int $status Must be 2 (accepted) or 3 (refused) {@min 2}{@max 3} + * @param int $status Must be 2 (accepted) or 3 (refused) {@min 2}{@max 3} * @param string $note_private Add this mention at end of private note * @param int $notrigger Disabled triggers - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * * @url POST {id}/close */ @@ -899,7 +899,7 @@ class Proposals extends DolibarrApi * Set a commercial proposal billed. Could be also called setbilled * * @param int $id Commercial proposal ID - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * * @url POST {id}/setinvoiced */ diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 0c0ee3133e4..1a43efcdd02 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -58,9 +58,9 @@ class Orders extends DolibarrApi * * @param int $id ID of order * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return array|mixed data without useless information + * @return array|mixed data without useless information * - * @throws RestException + * @throws RestException */ public function get($id, $contact_list = 1) { @@ -74,11 +74,11 @@ class Orders extends DolibarrApi * * @param string $ref Ref of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return array|mixed data without useless information + * @return array|mixed data without useless information * * @url GET ref/{ref} * - * @throws RestException + * @throws RestException */ public function getByRef($ref, $contact_list = 1) { @@ -92,11 +92,11 @@ class Orders extends DolibarrApi * * @param string $ref_ext External reference of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return array|mixed data without useless information + * @return array|mixed data without useless information * * @url GET ref_ext/{ref_ext} * - * @throws RestException + * @throws RestException */ public function getByRefExt($ref_ext, $contact_list = 1) { @@ -108,13 +108,13 @@ class Orders extends DolibarrApi * * Return an array with order informations * - * @param int $id ID of order + * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1) { @@ -150,11 +150,11 @@ class Orders extends DolibarrApi * * Get a list of orders * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects @@ -392,9 +392,9 @@ class Orders extends DolibarrApi /** * Update a line to given order * - * @param int $id Id of order to update - * @param int $lineid Id of line to update - * @param array $request_data OrderLine data + * @param int $id Id of order to update + * @param int $lineid Id of line to update + * @param array $request_data OrderLine data * @return Object|false Object with cleaned properties * * @url PUT {id}/lines/{lineid} @@ -458,8 +458,8 @@ class Orders extends DolibarrApi /** * Delete a line of a given order * - * @param int $id Id of order to update - * @param int $lineid Id of line to delete + * @param int $id Id of order to update + * @param int $lineid Id of line to delete * @return Object Object with cleaned properties * * @url DELETE {id}/lines/{lineid} @@ -495,13 +495,13 @@ class Orders extends DolibarrApi * * Return an array with contact informations * - * @param int $id ID of order - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) + * @param int $id ID of order + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) * @return Object Object with cleaned properties * * @url GET {id}/contacts * - * @throws RestException + * @throws RestException */ public function getContacts($id, $type = '') { @@ -622,8 +622,8 @@ class Orders extends DolibarrApi /** * Update order general fields (won't touch lines of order) * - * @param int $id Id of order to update - * @param array $request_data Datas + * @param int $id Id of order to update + * @param array $request_data Datas * @return Object Object with cleaned properties */ public function put($id, $request_data = null) @@ -792,7 +792,7 @@ class Orders extends DolibarrApi /** * Classify the order as invoiced. Could be also called setbilled * - * @param int $id Id of the order + * @param int $id Id of the order * @return Object Object with cleaned properties * * @url POST {id}/setinvoiced @@ -884,7 +884,7 @@ class Orders extends DolibarrApi * Set an order to draft * * @param int $id Order ID - * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) + * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return Object Object with cleaned properties * * @url POST {id}/settodraft @@ -1108,4 +1108,3 @@ class Orders extends DolibarrApi return $commande; } } - diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 2cecead3371..e05a911ffee 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -56,9 +56,9 @@ class BankAccounts extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param int $category Use this param to filter list by category + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array List of account objects * * @throws RestException @@ -122,8 +122,8 @@ class BankAccounts extends DolibarrApi /** * Get account by ID. * - * @param int $id ID of account - * @return Object Object with cleaned properties + * @param int $id ID of account + * @return Object Object with cleaned properties * * @throws RestException */ @@ -145,8 +145,8 @@ class BankAccounts extends DolibarrApi /** * Create account object * - * @param array $request_data Request data - * @return int ID of account + * @param array $request_data Request data + * @return int ID of account */ public function post($request_data = null) { @@ -313,9 +313,9 @@ class BankAccounts extends DolibarrApi /** * Update account * - * @param int $id ID of account - * @param array $request_data data - * @return Object Object with cleaned properties + * @param int $id ID of account + * @param array $request_data data + * @return Object Object with cleaned properties */ public function put($id, $request_data = null) { @@ -481,7 +481,7 @@ class BankAccounts extends DolibarrApi * @param string $accountancycode Accountancy code {@from body} * @param string $datev Payment date value (timestamp) {@from body} {@type timestamp} * @param string $num_releve Bank statement numero {@from body} - * @return int ID of line + * @return int ID of line * * @url POST {id}/lines */ @@ -528,7 +528,7 @@ class BankAccounts extends DolibarrApi /** * Add a link to an account line * - * @param int $id ID of account + * @param int $id ID of account * @param int $line_id ID of account line * @param int $url_id ID to set in the URL {@from body} * @param string $url URL of the link {@from body} diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 46ec4256a24..da77373569e 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2020 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,11 +65,11 @@ class Invoices extends DolibarrApi * * Return an array with invoice informations * - * @param int $id ID of invoice - * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses - * @return Object Object with cleaned properties + * @param int $id ID of invoice + * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id, $contact_list = 1) { @@ -82,12 +82,12 @@ class Invoices extends DolibarrApi * Return an array with invoice informations * * @param string $ref Ref of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses + * @return Object Object with cleaned properties * * @url GET ref/{ref} * - * @throws RestException + * @throws RestException */ public function getByRef($ref, $contact_list = 1) { @@ -100,12 +100,12 @@ class Invoices extends DolibarrApi * Return an array with invoice informations * * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses + * @return Object Object with cleaned properties * * @url GET ref_ext/{ref_ext} * - * @throws RestException + * @throws RestException */ public function getByRefExt($ref_ext, $contact_list = 1) { @@ -117,13 +117,13 @@ class Invoices extends DolibarrApi * * Return an array with invoice informations * - * @param int $id ID of order + * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses - * @return Object Object with cleaned properties + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1) { @@ -164,14 +164,14 @@ class Invoices extends DolibarrApi * * Get a list of invoices * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of invoice objects * * @throws RestException 404 Not found @@ -366,8 +366,8 @@ class Invoices extends DolibarrApi /** * Get lines of an invoice * - * @param int $id Id of invoice - * @return array Array of lines + * @param int $id Id of invoice + * @return array Array of lines * * @url GET {id}/lines */ @@ -396,9 +396,9 @@ class Invoices extends DolibarrApi /** * Update a line to a given invoice * - * @param int $id Id of invoice to update - * @param int $lineid Id of line to update - * @param array $request_data InvoiceLine data + * @param int $id Id of invoice to update + * @param int $lineid Id of line to update + * @param array $request_data InvoiceLine data * @return Object Object with cleaned properties * * @url PUT {id}/lines/{lineid} @@ -468,9 +468,9 @@ class Invoices extends DolibarrApi /** * Add a contact type of given invoice * - * @param int $id Id of invoice to update - * @param int $contactid Id of contact to add - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) + * @param int $id Id of invoice to update + * @param int $contactid Id of contact to add + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) * @return array * * @url POST {id}/contact/{contactid}/{type} @@ -515,9 +515,9 @@ class Invoices extends DolibarrApi /** * Delete a contact type of given invoice * - * @param int $id Id of invoice to update - * @param int $contactid Row key of the contact in the array contact_ids. - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). + * @param int $id Id of invoice to update + * @param int $contactid Row key of the contact in the array contact_ids. + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). * @return Object Object with cleaned properties * * @url DELETE {id}/contact/{contactid}/{type} @@ -560,9 +560,9 @@ class Invoices extends DolibarrApi /** * Deletes a line of a given invoice * - * @param int $id Id of invoice - * @param int $lineid Id of the line to delete - * @return Object Object with cleaned properties + * @param int $id Id of invoice + * @param int $lineid Id of the line to delete + * @return Object Object with cleaned properties * * @url DELETE {id}/lines/{lineid} * @@ -600,9 +600,9 @@ class Invoices extends DolibarrApi /** * Update invoice * - * @param int $id Id of invoice to update - * @param array $request_data Datas - * @return Object|false Object with cleaned properties + * @param int $id Id of invoice to update + * @param array $request_data Datas + * @return Object|false Object with cleaned properties */ public function put($id, $request_data = null) { @@ -643,8 +643,8 @@ class Invoices extends DolibarrApi /** * Delete invoice * - * @param int $id Invoice ID - * @return array + * @param int $id Invoice ID + * @return array */ public function delete($id) { @@ -770,10 +770,10 @@ class Invoices extends DolibarrApi /** * Adds a contact to an invoice * - * @param int $id Order ID - * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link - * @param string $type_contact Type of contact (code). Must a code found into table llx_c_type_contact. For example: BILLING - * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) + * @param int $id Order ID + * @param int $fk_socpeople Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link + * @param string $type_contact Type of contact (code). Must a code found into table llx_c_type_contact. For example: BILLING + * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $notrigger Disable all triggers * * @url POST {id}/contacts @@ -824,7 +824,7 @@ class Invoices extends DolibarrApi * * @param int $id Order ID * @param int $idwarehouse Warehouse ID - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * * @url POST {id}/settodraft * @@ -922,10 +922,10 @@ class Invoices extends DolibarrApi /** * Sets an invoice as paid * - * @param int $id Order ID - * @param string $close_code Code filled if we classify to 'Paid completely' when payment is not complete (for escompte for example) - * @param string $close_note Comment defined if we classify to 'Paid' when payment is not complete (for escompte for example) - * @return Object Object with cleaned properties + * @param int $id Order ID + * @param string $close_code Code filled if we classify to 'Paid completely' when payment is not complete (for escompte for example) + * @param string $close_note Comment defined if we classify to 'Paid' when payment is not complete (for escompte for example) + * @return Object Object with cleaned properties * * @url POST {id}/settopaid * @@ -973,7 +973,7 @@ class Invoices extends DolibarrApi /** * Sets an invoice as unpaid * - * @param int $id Order ID + * @param int $id Order ID * @return Object Object with cleaned properties * * @url POST {id}/settounpaid @@ -1059,7 +1059,7 @@ class Invoices extends DolibarrApi /** * Create a discount (credit available) for a credit note or a deposit. * - * @param int $id Invoice ID + * @param int $id Invoice ID * @return Object Object with cleaned properties * * @url POST {id}/markAsCreditAvailable @@ -1319,7 +1319,7 @@ class Invoices extends DolibarrApi /** * Get list of payments of a given invoice * - * @param int $id Id of invoice + * @param int $id Id of invoice * @return array * * @url GET {id}/payments @@ -1691,8 +1691,8 @@ class Invoices extends DolibarrApi /** * Validate fields before create or update object * - * @param array|null $data Datas to validate - * @return array + * @param array|null $data Datas to validate + * @return array * * @throws RestException */ @@ -1714,13 +1714,13 @@ class Invoices extends DolibarrApi * * Return an array with invoice informations * - * @param int $id ID of template invoice - * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses + * @param int $id ID of template invoice + * @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id, -1: Do not return contacts/adddesses * @return Object Object with cleaned properties * * @url GET templates/{id} * - * @throws RestException + * @throws RestException */ public function getTemplateInvoice($id, $contact_list = 1) { @@ -1732,13 +1732,13 @@ class Invoices extends DolibarrApi * * Return an array with invoice informations * - * @param int $id ID of order + * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id, -1: Do not return contacts/adddesses * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ private function _fetchTemplateInvoice($id, $ref = '', $ref_ext = '', $contact_list = 1) { diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 8876f60bc65..b99d2268b6b 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2018-2020 Frédéric France * @@ -61,8 +61,8 @@ class Contracts extends DolibarrApi * Return an array with contract informations * * @param int $id ID of contract - * @return Object Object with cleaned properties - * @throws RestException + * @return Object Object with cleaned properties + * @throws RestException */ public function get($id) { @@ -90,13 +90,13 @@ class Contracts extends DolibarrApi * * Get a list of contracts * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter contracts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter contracts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of contract objects * * @throws RestException 404 Not found @@ -371,11 +371,11 @@ class Contracts extends DolibarrApi /** * Activate a service line of a given contract * - * @param int $id Id of contract to activate - * @param int $lineid Id of line to activate - * @param string $datestart {@from body} Date start {@type timestamp} + * @param int $id Id of contract to activate + * @param int $lineid Id of line to activate + * @param string $datestart {@from body} Date start {@type timestamp} * @param string $dateend {@from body} Date end {@type timestamp} - * @param string $comment {@from body} Comment + * @param string $comment {@from body} Comment * * @url PUT {id}/lines/{lineid}/activate * @@ -410,10 +410,10 @@ class Contracts extends DolibarrApi /** * Unactivate a service line of a given contract * - * @param int $id Id of contract to activate - * @param int $lineid Id of line to activate - * @param string $datestart {@from body} Date start {@type timestamp} - * @param string $comment {@from body} Comment + * @param int $id Id of contract to activate + * @param int $lineid Id of line to activate + * @param string $datestart {@from body} Date start {@type timestamp} + * @param string $comment {@from body} Comment * * @url PUT {id}/lines/{lineid}/unactivate * diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 18bcab15ba4..8dc5bf4add6 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -57,9 +57,9 @@ class Donations extends DolibarrApi * Return an array with donation informations * * @param int $id ID of order - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -95,7 +95,7 @@ class Donations extends DolibarrApi * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 9894cacebde..ca8ec43ca84 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -59,9 +59,9 @@ class Shipments extends DolibarrApi * Return an array with shipment informations * * @param int $id ID of shipment - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -89,13 +89,13 @@ class Shipments extends DolibarrApi * * Get a list of shipments * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter shipments of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter shipments of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of shipment objects * * @throws RestException diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 2dee9a13b73..710a07e7cf0 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -59,9 +59,9 @@ class ExpenseReports extends DolibarrApi * Return an array with Expense Report informations * * @param int $id ID of Expense Report - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -91,9 +91,9 @@ class ExpenseReports extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of Expense Report objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 32a9d59132f..e90bb20aae3 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -73,9 +73,9 @@ class Interventions extends DolibarrApi * Return an array with Expense Report information * * @param int $id ID of Expense Report - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -100,13 +100,13 @@ class Interventions extends DolibarrApi * List of interventions * Return a list of interventions * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException @@ -258,7 +258,7 @@ class Interventions extends DolibarrApi /** * Add a line to given intervention * - * @param int $id Id of intervention to update + * @param int $id Id of intervention to update * @param array $request_data Request data * * @url POST {id}/lines @@ -340,8 +340,8 @@ class Interventions extends DolibarrApi * "notrigger": 0 * } * - * @param int $id Intervention ID - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @param int $id Intervention ID + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * * @url POST {id}/validate * @@ -377,7 +377,7 @@ class Interventions extends DolibarrApi /** * Close an intervention * - * @param int $id Intervention ID + * @param int $id Intervention ID * * @url POST {id}/close * diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 98cca7c95fa..09700c58855 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -58,10 +58,10 @@ class SupplierInvoices extends DolibarrApi * * Return an array with supplier invoice information * - * @param int $id ID of supplier invoice - * @return Object Object with cleaned properties + * @param int $id ID of supplier invoice + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -87,14 +87,14 @@ class SupplierInvoices extends DolibarrApi * * Get a list of supplier invoices * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter invoices of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter invoices of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of invoice objects * * @throws RestException @@ -663,7 +663,7 @@ class SupplierInvoices extends DolibarrApi * Deletes a line of a given supplier invoice * * @param int $id Id of supplier invoice - * @param int $lineid Id of the line to delete + * @param int $lineid Id of the line to delete * * @url DELETE {id}/lines/{lineid} * diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index c790472392a..dcf5856340c 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -56,10 +56,10 @@ class SupplierOrders extends DolibarrApi * * Return an array with supplier order information * - * @param int $id ID of supplier order - * @return array|mixed data without useless information + * @param int $id ID of supplier order + * @return array|mixed data without useless information * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -85,15 +85,15 @@ class SupplierOrders extends DolibarrApi * * Get a list of supplier orders * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $product_ids Product ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $status Filter by order status : draft | validated | approved | running | received_start | received_end | cancelled | refused * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException @@ -293,14 +293,14 @@ class SupplierOrders extends DolibarrApi * * Return an array with contact informations * - * @param int $id ID of supplier order - * @param string $source Source of the contact (internal, external, all). - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...) + * @param int $id ID of supplier order + * @param string $source Source of the contact (internal, external, all). + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...) * @return Object Object with cleaned properties * * @url GET {id}/contacts * - * @throws RestException + * @throws RestException */ public function getContacts($id, $source, $type = '') { @@ -334,10 +334,10 @@ class SupplierOrders extends DolibarrApi /** * Add a contact type of given supplier order * - * @param int $id Id of supplier order to update - * @param int $contactid Id of contact/user to add - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...) - * @param string $source Source of the contact (external, internal) + * @param int $id Id of supplier order to update + * @param int $contactid Id of contact/user to add + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...) + * @param string $source Source of the contact (external, internal) * @return array * * @url POST {id}/contact/{contactid}/{type}/{source} @@ -381,10 +381,10 @@ class SupplierOrders extends DolibarrApi /** * Unlink a contact type of given supplier order * - * @param int $id Id of supplier order to update - * @param int $contactid Id of contact/user to add - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...). - * @param string $source Source of the contact (internal, external). + * @param int $id Id of supplier order to update + * @param int $contactid Id of contact/user to add + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER, SALESREPFOLL, ...). + * @param string $source Source of the contact (internal, external). * * @url DELETE {id}/contact/{contactid}/{type}/{source} * @@ -440,7 +440,7 @@ class SupplierOrders extends DolibarrApi /** * Delete supplier order * - * @param int $id Supplier order ID + * @param int $id Supplier order ID * @return array Array of result */ public function delete($id) diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 7ecb878ee48..c4847c219d8 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -60,8 +60,8 @@ class KnowledgeManagement extends DolibarrApi * * Return an array with knowledgerecord informations * - * @param int $id ID of knowledgerecord - * @return Object Object with cleaned properties + * @param int $id ID of knowledgerecord + * @return Object Object with cleaned properties * * @url GET knowledgerecords/{id} * @@ -125,13 +125,13 @@ class KnowledgeManagement extends DolibarrApi * * Get a list of knowledgerecords * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 0034f102426..5780171bf75 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -61,8 +61,8 @@ class MyModuleApi extends DolibarrApi * * Return an array with myobject informations * - * @param int $id ID of myobject - * @return Object Object with cleaned properties + * @param int $id ID of myobject + * @return Object Object with cleaned properties * * @url GET myobjects/{id} * @@ -93,12 +93,12 @@ class MyModuleApi extends DolibarrApi * * Get a list of myobjects * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index ad21328995f..1c9d7d612da 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -55,11 +55,11 @@ class Mos extends DolibarrApi * * Return an array with MO informations * - * @param int $id ID of MO - * @return Object Object with cleaned properties + * @param int $id ID of MO + * @return Object Object with cleaned properties * * @url GET {id} - * @throws RestException + * @throws RestException */ public function get($id) { @@ -85,10 +85,10 @@ class Mos extends DolibarrApi * * Get a list of MOs * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects @@ -296,8 +296,8 @@ class Mos extends DolibarrApi * "arraytoproduce": [] * } * - * @param int $id ID of state - * @param array $request_data Request datas + * @param int $id ID of state + * @param array $request_data Request datas * * @url POST {id}/produceandconsume * diff --git a/htdocs/multicurrency/class/api_multicurrencies.class.php b/htdocs/multicurrency/class/api_multicurrencies.class.php index c0323fb928a..19cfad3adfe 100644 --- a/htdocs/multicurrency/class/api_multicurrencies.class.php +++ b/htdocs/multicurrency/class/api_multicurrencies.class.php @@ -45,10 +45,10 @@ class MultiCurrencies extends DolibarrApi * * @param string $sortfield Sort field * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names - * @return array Array of warehouse objects + * @param int $limit Limit for list + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @return array Array of warehouse objects * * @throws RestException */ @@ -109,7 +109,7 @@ class MultiCurrencies extends DolibarrApi * * Return an array with Currency informations * - * @param int $id ID of Currency + * @param int $id ID of Currency * @return Object Object with cleaned properties * * @throws RestException @@ -134,8 +134,8 @@ class MultiCurrencies extends DolibarrApi * Return an array with Currency informations * @url GET /bycode/{code} * - * @param string $code Code of Currency (ex: EUR) - * @return array|mixed Data without useless information + * @param string $code Code of Currency (ex: EUR) + * @return array|mixed Data without useless information * * @throws RestException */ @@ -159,8 +159,8 @@ class MultiCurrencies extends DolibarrApi * Get a list of Currency rates * * @url GET {id}/rates - * @param int $id ID of Currency - * @return array|mixed Data without useless information + * @param int $id ID of Currency + * @return array|mixed Data without useless information * * @throws RestException */ @@ -191,7 +191,7 @@ class MultiCurrencies extends DolibarrApi * Create Currency object * * @param array $request_data Request data - * @return int ID of Currency + * @return int ID of Currency * * @throws RestException */ @@ -235,7 +235,7 @@ class MultiCurrencies extends DolibarrApi * * @param int $id Id of Currency to update * @param array $request_data Datas - * @return array The updated Currency + * @return array The updated Currency * * @throws RestException */ @@ -302,7 +302,7 @@ class MultiCurrencies extends DolibarrApi * * @param int $id Currency ID * @param array $request_data Request data - * @return Object|false Object with cleaned properties + * @return Object|false Object with cleaned properties * * @throws RestException */ @@ -335,7 +335,7 @@ class MultiCurrencies extends DolibarrApi * Clean sensible object datas * * @param MultiCurrency $object Object to clean - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { @@ -361,7 +361,7 @@ class MultiCurrencies extends DolibarrApi * Clean sensible MultiCurrencyRate object datas * * @param MultiCurrency $object Object to clean - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties */ protected function _cleanObjectDatasRate($object) { diff --git a/htdocs/partnership/class/api_partnership.class.php b/htdocs/partnership/class/api_partnership.class.php index 742030e04e9..515c43d62cd 100644 --- a/htdocs/partnership/class/api_partnership.class.php +++ b/htdocs/partnership/class/api_partnership.class.php @@ -59,8 +59,8 @@ class PartnershipApi extends DolibarrApi * * Return an array with partnership informations * - * @param int $id ID of partnership - * @return Object Object with cleaned properties + * @param int $id ID of partnership + * @return Object Object with cleaned properties * * @url GET partnerships/{id} * @@ -91,12 +91,12 @@ class PartnershipApi extends DolibarrApi * * Get a list of partnerships * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 29825e9c05a..69e3d5f92c6 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -162,19 +162,19 @@ class Products extends DolibarrApi * * Get a list of products * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" - * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) - * @param int $variant_filter Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) - * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0 + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) + * @param int $variant_filter Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) + * @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0 * @param int $includestockdata Load also information about stock (slower) - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names - * @return array Array of product objects + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @return array Array of product objects */ public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0, $pagination_data = false, $includestockdata = 0, $properties = '') { @@ -432,7 +432,7 @@ class Products extends DolibarrApi /** * Delete product * - * @param int $id Product ID + * @param int $id Product ID * @return array */ public function delete($id) @@ -644,8 +644,8 @@ class Products extends DolibarrApi /** * Get prices per customer for a product * - * @param int $id ID of product - * @param string $thirdparty_id Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i} + * @param int $id ID of product + * @param string $thirdparty_id Thirdparty id to filter orders of (example '1') {@pattern /^[0-9,]*$/i} * * @return mixed * @@ -731,28 +731,28 @@ class Products extends DolibarrApi * Add/Update purchase prices for a product. * * @param int $id ID of Product - * @param float $qty Min quantity for which price is valid - * @param float $buyprice Purchase price for the quantity min - * @param string $price_base_type HT or TTC - * @param int $fourn_id Supplier ID - * @param int $availability Product availability - * @param string $ref_fourn Supplier ref - * @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string) - * @param string $charges costs affering to product - * @param float $remise_percent Discount regarding qty (percent) - * @param float $remise Discount regarding qty (amount) - * @param int $newnpr Set NPR or not - * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined. + * @param float $qty Min quantity for which price is valid + * @param float $buyprice Purchase price for the quantity min + * @param string $price_base_type HT or TTC + * @param int $fourn_id Supplier ID + * @param int $availability Product availability + * @param string $ref_fourn Supplier ref + * @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string) + * @param string $charges costs affering to product + * @param float $remise_percent Discount regarding qty (percent) + * @param float $remise Discount regarding qty (amount) + * @param int $newnpr Set NPR or not + * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined. * @param string $supplier_reputation Reputation with this product to the defined supplier (empty, FAVORITE, DONOTORDER) - * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). - * @param string $newdefaultvatcode Default vat code - * @param float $multicurrency_buyprice Purchase price for the quantity min in currency - * @param string $multicurrency_price_base_type HT or TTC in currency - * @param float $multicurrency_tx Rate currency - * @param string $multicurrency_code Currency code - * @param string $desc_fourn Custom description for product_fourn_price - * @param string $barcode Barcode - * @param int $fk_barcode_type Barcode type + * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). + * @param string $newdefaultvatcode Default vat code + * @param float $multicurrency_buyprice Purchase price for the quantity min in currency + * @param string $multicurrency_price_base_type HT or TTC in currency + * @param float $multicurrency_tx Rate currency + * @param string $multicurrency_code Currency code + * @param string $desc_fourn Custom description for product_fourn_price + * @param string $barcode Barcode + * @param int $fk_barcode_type Barcode type * @return int * * @throws RestException 500 System error @@ -1011,7 +1011,7 @@ class Products extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:color)" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array * * @throws RestException 401 @@ -1078,8 +1078,8 @@ class Products extends DolibarrApi /** * Get attribute by ID. * - * @param int $id ID of Attribute - * @return Object Object with cleaned properties + * @param int $id ID of Attribute + * @return Object Object with cleaned properties * * @throws RestException 401 * @throws RestException 404 @@ -1253,9 +1253,9 @@ class Products extends DolibarrApi /** * Update attributes by id. * - * @param int $id ID of Attribute - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id ID of Attribute + * @param array $request_data Datas + * @return Object Object with cleaned properties * * @throws RestException * @throws RestException 401 @@ -1301,7 +1301,7 @@ class Products extends DolibarrApi /** * Delete attributes by id. * - * @param int $id ID of Attribute + * @param int $id ID of Attribute * @return int Result of deletion * * @throws RestException 500 System error @@ -1561,9 +1561,9 @@ class Products extends DolibarrApi /** * Update attribute value. * - * @param int $id ID of Attribute - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id ID of Attribute + * @param array $request_data Datas + * @return Object Object with cleaned properties * * @throws RestException 401 * @throws RestException 500 System error @@ -1634,7 +1634,7 @@ class Products extends DolibarrApi /** * Get product variants. * - * @param int $id ID of Product + * @param int $id ID of Product * @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant * @return array * @@ -1859,7 +1859,7 @@ class Products extends DolibarrApi /** * Delete product variants. * - * @param int $id ID of Variant + * @param int $id ID of Variant * @return int Result of deletion * * @throws RestException 500 System error @@ -2016,16 +2016,16 @@ class Products extends DolibarrApi * Get properties of 1 product object. * Return an array with product information. * - * @param int $id ID of product - * @param string $ref Ref of element - * @param string $ref_ext Ref ext of element - * @param string $barcode Barcode of element - * @param int $includestockdata Load also information about stock (slower) - * @param bool $includesubproducts Load information about subproducts (if product is a virtual product) - * @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product) + * @param int $id ID of product + * @param string $ref Ref of element + * @param string $ref_ext Ref ext of element + * @param string $barcode Barcode of element + * @param int $includestockdata Load also information about stock (slower) + * @param bool $includesubproducts Load information about subproducts (if product is a virtual product) + * @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product) * @param bool $includeifobjectisused Check if product object is used and set property 'is_object_used' with result. * @param bool $includetrans Load also the translations of product label and description - * @return array|mixed Data without useless information + * @return array|mixed Data without useless information * * @throws RestException 401 * @throws RestException 403 diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index f3de23631d1..36351c53374 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -57,10 +57,10 @@ class StockMovements extends DolibarrApi * * Return an array with stock movement informations * - * @param int $id ID of movement - * @return Object Object with cleaned properties + * @param int $id ID of movement + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ /* public function get($id) @@ -89,7 +89,7 @@ class StockMovements extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.product_id:=:1) and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of warehouse objects * * @throws RestException diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index a2744897dc4..03d60ba7848 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -55,10 +55,10 @@ class Warehouses extends DolibarrApi * * Return an array with warehouse informations * - * @param int $id ID of warehouse - * @return Object Object with cleaned properties + * @param int $id ID of warehouse + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -89,7 +89,7 @@ class Warehouses extends DolibarrApi * @param int $page Page number * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of warehouse objects * * @throws RestException diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 89a01be3f4c..493ba4108ed 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -65,9 +65,9 @@ class Projects extends DolibarrApi * Return an array with project informations * * @param int $id ID of project - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -95,14 +95,14 @@ class Projects extends DolibarrApi * * Get a list of projects * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of project objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $properties = '') diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 157ff99fc33..30ba131cb06 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -61,9 +61,9 @@ class Tasks extends DolibarrApi * * @param int $id ID of task * @param int $includetimespent 0=Return only task. 1=Include a summary of time spent, 2=Include details of time spent lines - * @return array|mixed data without useless information + * @return array|mixed data without useless information * - * @throws RestException + * @throws RestException */ public function get($id, $includetimespent = 0) { @@ -97,12 +97,12 @@ class Tasks extends DolibarrApi * * Get a list of tasks * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of project objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') @@ -269,7 +269,7 @@ class Tasks extends DolibarrApi * * @param int $id Id of task * @param int $userid Id of user (0 = connected user) - * @return array Array of roles + * @return array Array of roles * * @url GET {id}/roles * diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 415f856e29a..f7d23972a39 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -59,8 +59,8 @@ class Receptions extends DolibarrApi * Return an array with reception informations * * @param int $id ID of reception - * @return Object Object with cleaned properties - * @throws RestException + * @return Object Object with cleaned properties + * @throws RestException */ public function get($id) { @@ -88,13 +88,13 @@ class Receptions extends DolibarrApi * * Get a list of receptions * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter receptions of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter receptions of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of reception objects * * @throws RestException @@ -427,9 +427,9 @@ class Receptions extends DolibarrApi /** * Update reception general fields (won't touch lines of reception) * - * @param int $id Id of reception to update - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id Id of reception to update + * @param array $request_data Datas + * @return Object Object with cleaned properties */ public function put($id, $request_data = null) { @@ -497,8 +497,8 @@ class Receptions extends DolibarrApi * This may record stock movements if module stock is enabled and option to * decrease stock on reception is on. * - * @param int $id Reception ID - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @param int $id Reception ID + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * * @url POST {id}/validate * @@ -625,8 +625,8 @@ class Receptions extends DolibarrApi /** * Close a reception (Classify it as "Delivered") * - * @param int $id Reception ID - * @param int $notrigger Disabled triggers + * @param int $id Reception ID + * @param int $notrigger Disabled triggers * * @url POST {id}/close * diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php index be9def9324d..91b5934ab06 100644 --- a/htdocs/recruitment/class/api_recruitment.class.php +++ b/htdocs/recruitment/class/api_recruitment.class.php @@ -66,8 +66,8 @@ class Recruitment extends DolibarrApi * * Return an array with jobposition informations * - * @param int $id ID of jobposition - * @return Object Object with cleaned properties + * @param int $id ID of jobposition + * @return Object Object with cleaned properties * * @url GET jobposition/{id} * @@ -97,7 +97,7 @@ class Recruitment extends DolibarrApi * * Return an array with candidature informations * - * @param int $id ID of candidature + * @param int $id ID of candidature * @return Object Object with cleaned properties * * @url GET candidature/{id} @@ -129,12 +129,12 @@ class Recruitment extends DolibarrApi * * Get a list of jobpositions * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException @@ -237,10 +237,10 @@ class Recruitment extends DolibarrApi * * Get a list of candidatures * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects * @@ -406,9 +406,9 @@ class Recruitment extends DolibarrApi /** * Update jobposition * - * @param int $id Id of jobposition to update - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id Id of jobposition to update + * @param array $request_data Datas + * @return Object Object with cleaned properties * * @throws RestException * @@ -449,9 +449,9 @@ class Recruitment extends DolibarrApi /** * Update candidature * - * @param int $id Id of candidature to update - * @param array $request_data Datas - * @return Object Object with cleaned properties + * @param int $id Id of candidature to update + * @param array $request_data Datas + * @return Object Object with cleaned properties * * @throws RestException * diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 0e01e9b4b58..f32d95668b1 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -62,12 +62,12 @@ class Contacts extends DolibarrApi * * Return an array with contact informations * - * @param int $id ID of contact + * @param int $id ID of contact * @param int $includecount Count and return also number of elements the contact is used as a link for * @param int $includeroles Includes roles of the contact - * @return array|mixed data without useless information + * @return array|mixed data without useless information * - * @throws RestException + * @throws RestException */ public function get($id, $includecount = 0, $includeroles = 0) { @@ -107,10 +107,10 @@ class Contacts extends DolibarrApi /** * Get properties of a contact object by Email * - * @param string $email Email of contact + * @param string $email Email of contact * @param int $includecount Count and return also number of elements the contact is used as a link for * @param int $includeroles Includes roles of the contact - * @return array|mixed data without useless information + * @return array|mixed data without useless information * * @url GET email/{email} * @@ -157,16 +157,16 @@ class Contacts extends DolibarrApi * * Get a list of contacts * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param int $category Use this param to filter list by category + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param int $includecount Count and return also number of elements the contact is used as a link for - * @param int $includeroles Includes roles of the contact - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param int $includeroles Includes roles of the contact + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of contact objects * * @throws RestException @@ -373,7 +373,7 @@ class Contacts extends DolibarrApi /** * Create an user account object from contact (external user) * - * @param int $id Id of contact + * @param int $id Id of contact * @param array $request_data Request datas * @return int ID of user * diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 60d9030024f..dd7e8058ba2 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -67,10 +67,10 @@ class Thirdparties extends DolibarrApi * * Return an array with thirdparty informations * - * @param int $id Id of third party to load - * @return Object Object with cleaned properties + * @param int $id Id of third party to load + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -124,9 +124,9 @@ class Thirdparties extends DolibarrApi * Set to 2 to show only prospects * Set to 3 to show only those are not customer neither prospect * Set to 4 to show only suppliers - * @param int $category Use this param to filter list by category + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "((t.nom:like:'TheCompany%') or (t.name_alias:like:'TheCompany%')) and (t.datec:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of thirdparty objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $properties = '') @@ -846,12 +846,12 @@ class Thirdparties extends DolibarrApi /** * Get outstanding proposals of thirdparty * - * @param int $id ID of the thirdparty - * @param string $mode 'customer' or 'supplier' + * @param int $id ID of the thirdparty + * @param string $mode 'customer' or 'supplier' * * @url GET {id}/outstandingproposals * - * @return array List of outstandings proposals of thirdparty + * @return array List of outstandings proposals of thirdparty * * @throws RestException 400 * @throws RestException 401 @@ -888,12 +888,12 @@ class Thirdparties extends DolibarrApi /** * Get outstanding orders of thirdparty * - * @param int $id ID of the thirdparty - * @param string $mode 'customer' or 'supplier' + * @param int $id ID of the thirdparty + * @param string $mode 'customer' or 'supplier' * * @url GET {id}/outstandingorders * - * @return array List of outstandings orders of thirdparty + * @return array List of outstandings orders of thirdparty * * @throws RestException 400 * @throws RestException 401 @@ -929,12 +929,12 @@ class Thirdparties extends DolibarrApi /** * Get outstanding invoices of thirdparty * - * @param int $id ID of the thirdparty - * @param string $mode 'customer' or 'supplier' + * @param int $id ID of the thirdparty + * @param string $mode 'customer' or 'supplier' * * @url GET {id}/outstandinginvoices * - * @return array List of outstandings invoices of thirdparty + * @return array List of outstandings invoices of thirdparty * * @throws RestException 400 * @throws RestException 401 @@ -970,12 +970,12 @@ class Thirdparties extends DolibarrApi /** * Get representatives of thirdparty * - * @param int $id ID of the thirdparty - * @param string $mode 0=Array with properties, 1=Array of id. + * @param int $id ID of the thirdparty + * @param string $mode 0=Array with properties, 1=Array of id. * * @url GET {id}/representatives * - * @return array List of representatives of thirdparty + * @return array List of representatives of thirdparty * * @throws RestException 400 * @throws RestException 401 @@ -1008,10 +1008,10 @@ class Thirdparties extends DolibarrApi /** * Get fixed amount discount of a thirdparty (all sources: deposit, credit note, commercial offers...) * - * @param int $id ID of the thirdparty - * @param string $filter Filter exceptional discount. "none" will return every discount, "available" returns unapplied discounts, "used" returns applied discounts {@choice none,available,used} - * @param string $sortfield Sort field - * @param string $sortorder Sort order + * @param int $id ID of the thirdparty + * @param string $filter Filter exceptional discount. "none" will return every discount, "available" returns unapplied discounts, "used" returns applied discounts {@choice none,available,used} + * @param string $sortfield Sort field + * @param string $sortorder Sort order * * @url GET {id}/fixedamountdiscounts * @@ -1348,9 +1348,9 @@ class Thirdparties extends DolibarrApi /** * Generate a Document from a bank account record (like SEPA mandate) * - * @param int $id Thirdparty id - * @param int $companybankid Companybank id - * @param string $model Model of document to generate + * @param int $id Thirdparty id + * @param int $companybankid Companybank id + * @param string $model Model of document to generate * @return array * * @url GET {id}/generateBankAccountDocument/{companybankid}/{model} @@ -1651,9 +1651,9 @@ class Thirdparties extends DolibarrApi /** * Update specified values of a specific gateway attached to a thirdparty * - * @param int $id Id of thirdparty - * @param string $site Site key - * @param array $request_data Request data + * @param int $id Id of thirdparty + * @param string $site Site key + * @param array $request_data Request data * * @return array|mixed * @@ -1861,7 +1861,7 @@ class Thirdparties extends DolibarrApi * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) - * @param string $email Email of third party (Warning, this can return several records) + * @param string $email Email of third party (Warning, this can return several records) * @param string $ref_alias Name_alias of third party (Warning, this can return several records) * @return array|mixed cleaned Societe object * diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 92dbaf07c3f..a038ef63649 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -58,9 +58,9 @@ class SupplierProposals extends DolibarrApi * Return an array with supplier proposal informations * * @param int $id ID of supplier proposal - * @return Object Object with cleaned properties + * @return Object Object with cleaned properties * - * @throws RestException + * @throws RestException */ public function get($id) { @@ -86,11 +86,11 @@ class SupplierProposals extends DolibarrApi * * Get a list of supplier proposals * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter supplier proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter supplier proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 4bf1116d018..f4b28992e0a 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -65,8 +65,8 @@ class Tickets extends DolibarrApi * * Return an array with ticket informations * - * @param int $id ID of ticket - * @return Object Object with cleaned properties + * @param int $id ID of ticket + * @return Object Object with cleaned properties * * @throws RestException 401 * @throws RestException 403 @@ -82,14 +82,14 @@ class Tickets extends DolibarrApi * * Return an array with ticket informations * - * @param string $track_id Tracking ID of ticket - * @return array|mixed Data without useless information + * @param string $track_id Tracking ID of ticket + * @return array|mixed Data without useless information * * @url GET track_id/{track_id} * - * @throws RestException 401 - * @throws RestException 403 - * @throws RestException 404 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function getByTrackId($track_id) { @@ -101,8 +101,8 @@ class Tickets extends DolibarrApi * * Return an array with ticket informations * - * @param string $ref Reference for ticket - * @return array|mixed Data without useless information + * @param string $ref Reference for ticket + * @return array|mixed Data without useless information * * @url GET ref/{ref} * @@ -119,10 +119,10 @@ class Tickets extends DolibarrApi * Get properties of a Ticket object * Return an array with ticket informations * - * @param int $id ID of ticket - * @param string $track_id Tracking ID of ticket - * @param string $ref Reference for ticket - * @return array|mixed Data without useless information + * @param int $id ID of ticket + * @param string $track_id Tracking ID of ticket + * @param string $ref Reference for ticket + * @return array|mixed Data without useless information */ private function getCommon($id = 0, $track_id = '', $ref = '') { @@ -194,7 +194,7 @@ class Tickets extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101') and (t.fk_statut:=:1)" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * * @return array Array of ticket objects * diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 2dec0e96999..7f2c59319c1 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2020 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,10 +63,10 @@ class Users extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of User objects */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $category = 0, $sqlfilters = '', $properties = '') @@ -143,9 +143,9 @@ class Users extends DolibarrApi /** * Get properties of an user object * - * @param int $id ID of user + * @param int $id ID of user * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed data without useless information + * @return array|mixed data without useless information * * @throws RestException 401 Insufficient rights * @throws RestException 404 User or group not found @@ -179,15 +179,15 @@ class Users extends DolibarrApi /** * Get properties of an user object by login * - * @param string $login Login of user + * @param string $login Login of user * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed Data without useless information + * @return array|mixed Data without useless information * * @url GET login/{login} * * @throws RestException 400 Bad request - * @throws RestException 401 Insufficient rights - * @throws RestException 404 User or group not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 User or group not found */ public function getByLogin($login, $includepermissions = 0) { @@ -218,9 +218,9 @@ class Users extends DolibarrApi /** * Get properties of an user object by Email * - * @param string $email Email of user + * @param string $email Email of user * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed Data without useless information + * @return array|mixed Data without useless information * * @url GET email/{email} * @@ -260,7 +260,7 @@ class Users extends DolibarrApi * @url GET /info * * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed Data without useless information + * @return array|mixed Data without useless information * * @throws RestException 401 Insufficient rights * @throws RestException 404 User or group not found @@ -347,9 +347,9 @@ class Users extends DolibarrApi /** * Update user account * - * @param int $id Id of account to update - * @param array $request_data Datas - * @return array|mixed Record after update + * @param int $id Id of account to update + * @param array $request_data Datas + * @return array|mixed Record after update * * @throws RestException 401 Not allowed * @throws RestException 404 Not found @@ -514,9 +514,9 @@ class Users extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $group_ids Groups ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param string $group_ids Groups ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of User objects * * @throws RestException 404 User not found @@ -591,7 +591,7 @@ class Users extends DolibarrApi * * @url GET /groups/{group} * - * @param int $group ID of group + * @param int $group ID of group * @param int $load_members Load members list or not {@min 0} {@max 1} * @return object object of User objects * @@ -657,8 +657,8 @@ class Users extends DolibarrApi /** * Clean sensible object datas * - * @param Object $object Object to clean - * @return Object Object with cleaned properties + * @param Object $object Object to clean + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index bdfdaecf493..6689e28c0e1 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -66,8 +66,8 @@ class Zapier extends DolibarrApi * * Return an array with hook informations * - * @param int $id ID of hook - * @return Object Object with cleaned properties + * @param int $id ID of hook + * @return Object Object with cleaned properties * * @url GET /hooks/{id} * @throws RestException @@ -135,7 +135,7 @@ class Zapier extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names + * @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * * @throws RestException