diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index 6c7a47a2b5c..cedcb31b14d 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -31,7 +31,6 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } - $page=$_GET["page"]; $begin=$_GET["begin"]; $sortorder=$_GET["sortorder"]; @@ -44,17 +43,18 @@ $pageprev = $_GET["page"] - 1; $pagenext = $_GET["page"] + 1; -$sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st WHERE s.fk_stcomm = st.id AND s.client=1"; +$sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm "; +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st "; +$sql .= " WHERE s.fk_stcomm = st.id AND s.client=1"; if ($socidp) { $sql .= " AND s.idp = $socidp"; } - -if (strlen($stcomm)) +if ($_GET["search_nom"]) { - $sql .= " AND s.fk_stcomm=$stcomm"; + $sql .= " AND s.nom like '%".strtolower($_GET["search_nom"])."%'"; } if (strlen($begin)) @@ -127,12 +127,24 @@ if ($result) print '
| "; - print_liste_field_titre("Société","clients.php","s.nom","&page=$page&begin=$begin"); - print " | "; - print_liste_field_titre("Ville","clients.php","s.ville","&page=$page&begin=$begin"); - print " | "; - print ""; + + $addu = "&page=$page&begin=$begin&search_nom=".$_GET["search_nom"]; + + print_liste_field_titre("Société","clients.php","s.nom",$addu); + print " | "; + print_liste_field_titre("Ville","clients.php","s.ville",$addu); + print " | "; + print "\n"; + + print '
|---|