diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index e96d71fed4f..1f5c1e27e2f 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -191,6 +191,23 @@ if (strlen($stcomm)) $sql .= " AND s.fk_stcomm=$stcomm"; } +if ($socname) +{ + $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; + $sortfield = "lower(s.nom)"; + $sortorder = "ASC"; +} + +if ($_GET["search_nom"]) +{ + $sql .= " AND lower(s.nom) like '%".strtolower($_GET["search_nom"])."%'"; +} + +if ($_GET["search_compta"]) +{ + $sql .= " AND s.code_compta like '%".$_GET["search_compta"]."%'"; +} + if (strlen($begin)) { $sql .= " AND upper(s.nom) like '$begin%'"; @@ -201,13 +218,6 @@ if ($user->societe_id) $sql .= " AND s.idp = " .$user->societe_id; } -if ($socname) -{ - $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; - $sortfield = "lower(s.nom)"; - $sortorder = "ASC"; -} - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); $result = $db->query($sql); @@ -239,22 +249,22 @@ if ($result) print_liste_field_titre($langs->trans("Town"),"clients.php","s.ville","","",'valign="center"',$sortfield); print_liste_field_titre($langs->trans("Code client"),"clients.php","s.code_client","","",'align="center"',$sortfield); - print "\n"; + print "