diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index db8c279b575..5cba8258a8d 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -579,13 +579,13 @@ class Orders extends DolibarrApi } /** - * Get contacts of given order + * Get contacts of a given order * * Return an array with contact information * - * @param int $id ID of order - * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER) - * @return Object Object with cleaned properties + * @param int $id ID of order + * @param string $type Type of the contact ('BILLING', 'SHIPPING', 'CUSTOMER', ...) + * @return array Array of contacts * * @url GET {id}/contacts * @@ -608,7 +608,7 @@ class Orders extends DolibarrApi $contacts = $this->commande->liste_contact(-1, 'external', 0, $type); - return $this->_cleanObjectDatas($contacts); + return $contacts; } /** diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7e5f14166aa..44f12551acd 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1905,7 +1905,7 @@ class Contact extends CommonObject * Get thirdparty contact roles of a given contact * * @param string $element Element type - * @return array|int<-1,-1> Array of contact roles or -1 + * @return array|int<-1,-1> Array of contact roles or -1 if error * @throws Exception */ public function getContactRoles($element = '') @@ -1921,20 +1921,19 @@ class Contact extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; $sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1"; - $sql .= " WHERE sc.fk_soc =".((int) $this->socid); + $sql .= " WHERE sc.fk_soc = ".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND sp.entity IN (".getEntity('contact').")"; $sql .= " AND tc.active = 1"; - dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); - $tab[] = array('fk_socpeople' => $obj->id, 'type_contact' => $obj->fk_c_type_contact); + $tab[$obj->id] = array('fk_socpeople' => $obj->id, 'type_contact' => $obj->fk_c_type_contact); $i++; } diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 7a54b3be21d..11b0d072615 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -404,10 +404,10 @@ class SupplierOrders extends DolibarrApi * * Return an array with contact information * - * @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 + * @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 array Array of contacts * * @url GET {id}/contacts * @@ -439,7 +439,7 @@ class SupplierOrders extends DolibarrApi $contacts = array_merge($contacts, $tmpContacts); } - return $this->_cleanObjectDatas($contacts); + return $contacts; } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3d29d864aa7..635b5465ef6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5738,7 +5738,7 @@ class Societe extends CommonObject if (!$list) { $transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->type_label); - $tab[$i] = array( + $tab[$obj->id] = array( 'source' => $obj->source, 'socid' => $obj->socid, 'id' => $obj->id, @@ -5758,7 +5758,7 @@ class Societe extends CommonObject 'fk_c_type_contact' => $obj->fk_c_type_contact ); } else { - $tab[$i] = $obj->id; + $tab[$obj->id] = $obj->id; } $i++;