From 90732627b58554fc57e1fd9017fef9ff4cc4c15b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Jan 2004 17:34:32 +0000 Subject: [PATCH] =?UTF-8?q?Le=20libell=E9=20des=20contacts=20d=E9crit=20si?= =?UTF-8?q?=20il=20s'agit=20d'une=20liste=20de=20contact=20client-prospet?= =?UTF-8?q?=20seulement,=20fournisseur=20ou=20tout=20type.=20Les=20raccour?= =?UTF-8?q?cis=20alphabet=20sont=20pr=E9sent=20sur=20cette=20page=20=E0=20?= =?UTF-8?q?l'identique=20des=20raccourcis=20sur=20la=20page=20des=20contac?= =?UTF-8?q?ts=20fournisseurs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/contact.php | 80 ++++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 44c4dde4ced..36a3582dda9 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -22,6 +22,8 @@ */ require("./pre.inc.php"); +llxHeader(); + /* * Sécurité accés client */ @@ -31,8 +33,6 @@ if ($user->societe_id > 0) $socid = $user->societe_id; } -llxHeader(); - if ($sortorder == "") { $sortorder="ASC"; @@ -46,6 +46,15 @@ if ($page == -1) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; + +if ($type == "c") { + $label = " prospects/clients"; +} +if ($type == "f") { + $label = " fournisseurs"; +} + + /* * * Mode liste @@ -54,10 +63,18 @@ $offset = $limit * $page ; */ $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; -$sql .= "FROM llx_societe as s, llx_socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc"; +$sql .= " FROM llx_societe as s, llx_socpeople as p, c_stcomm as st"; +$sql .= " WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc"; -if (strlen($stcomm)) // statut commercial -{ +if ($type == "c") { + $sql .= " AND s.client = 1"; +} +if ($type == "f") { + $sql .= " AND s.fournisseur = 1"; +} + + +if (strlen($stcomm)) { $sql .= " AND s.fk_stcomm=$stcomm"; } @@ -66,36 +83,48 @@ if (strlen($begin)) // filtre sur la premiere lettre du nom $sql .= " AND upper(p.name) like '$begin%'"; } -if ($contactname) // acces a partir du module de recherche +if ($_GET[contactname]) // acces a partir du module de recherche { - $sql .= " AND ( lower(p.name) like '%".strtolower($contactname)."%' OR lower(p.firstname) like '%".strtolower($contactname)."%') "; + $sql .= " AND ( lower(p.name) like '%".strtolower($_GET[contactname])."%' OR lower(p.firstname) like '%".strtolower($_GET[contactname])."%') "; $sortfield = "lower(p.name)"; $sortorder = "ASC"; } -if ($socid) -{ +if ($socid) { $sql .= " AND s.idp = $socid"; } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit+1, $offset); +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); $result = $db->query($sql); - if ($result) -{ + { $num = $db->num_rows(); - $i = 0; - print_barre_liste("Liste des contacts",$page, $PHP_SELF,"",$sortfield,$sortorder,"",$num); - if ($sortorder == "DESC") - { - $sortorder="ASC"; - } - else - { - $sortorder="DESC"; - } - print ''; + + print_barre_liste("Liste des contacts $label",$page, $PHP_SELF, "",$sortfield,$sortorder,"",$num); + + print "
"; + + print "| *\n| "; + for ($i = 65 ; $i < 91; $i++) { + print ""; + + if ($begin == chr($i) ) { + print "->" . chr($i) . "<-" ; + } else { + print chr($i) ; + } + print " | "; + } + print "
"; + + if ($sortorder == "DESC") { + $sortorder="ASC"; + } else { + $sortorder="DESC"; + } + + print '

'; print ""; print "'; print "\n"; $var=True; + $i = 0; while ($i < min($num,$limit)) { $obj = $db->fetch_object( $i); @@ -118,7 +148,7 @@ if ($result) print ''; print ""; - print '\n"; print ''; @@ -136,7 +166,7 @@ if ($result) print "\n"; $i++; } - print "
"; print_liste_field_titre("Nom",$PHP_SELF,"lower(p.name)", $begin); @@ -107,6 +136,7 @@ if ($result) print 'Téléphone 
'.$obj->name.'$obj->firstnamefiltrer '; + print 'filtrer '; print "idp\">$obj->nom'.$obj->email.' 
"; + print "

"; $db->free(); } else { print $db->error();