diff --git a/ChangeLog b/ChangeLog index d93f5199c40..929981d4ae4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,7 @@ For developers: - New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. - New: renamed table llx_c_pays to llx_c_country & libelle field to label. - New: Added hook "formConfirm" and "doActions" for fichinter card +- New: Can search list of thirdparties from web service on part of name. - Qual: Renamed table llx_c_civilite into llx_c_civility, field civilite into label in the same table, and field civilite into civility in other table. diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 301511e0115..2d104eb96a1 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -629,7 +629,7 @@ function updateThirdParty($authentication,$thirdparty) * getListOfThirdParties * * @param array $authentication Array of authentication information - * @param array $filterthirdparty Filter fields + * @param array $filterthirdparty Filter fields (key=>value to filer on. For example 'client'=>2, 'supplier'=>1, 'category'=>idcateg, 'name'=>'searchstring', ...) * @return array Array result */ function getListOfThirdParties($authentication,$filterthirdparty) @@ -661,9 +661,10 @@ function getListOfThirdParties($authentication,$filterthirdparty) $sql.=" WHERE entity=".$conf->entity; foreach($filterthirdparty as $key => $val) { - if ($key == 'client' && $val != '') $sql.=" AND s.client = ".$db->escape($val); + if ($key == 'name' && $val != '') $sql.=" AND s.name LIKE '%".$db->escape($val)."%'"; + if ($key == 'client' && $val != '') $sql.=" AND s.client = ".$db->escape($val); if ($key == 'supplier' && $val != '') $sql.=" AND s.fournisseur = ".$db->escape($val); - if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; + if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; } dol_syslog("Function: getListOfThirdParties", LOG_DEBUG);