diff --git a/htdocs/comm/contact.php3 b/htdocs/comm/contact.php3 index ae33808e36a..33188ef22f3 100644 --- a/htdocs/comm/contact.php3 +++ b/htdocs/comm/contact.php3 @@ -48,36 +48,45 @@ print_barre_liste("Liste des contacts",$page, $PHP_SELF); $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; $sql .= "FROM societe as s, socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc"; -if (strlen($stcomm)) { +if (strlen($stcomm)) // statut commercial +{ $sql .= " AND s.fk_stcomm=$stcomm"; } -if (strlen($begin)) { +if (strlen($begin)) // filtre sur la premiere lettre du nom +{ $sql .= " AND upper(p.name) like '$begin%'"; } -if ($contactname) { - $sql .= " AND lower(p.name) like '%".strtolower($contactname)."%'"; +if ($contactname) // acces a partir du module de recherche +{ + $sql .= " AND ( lower(p.name) like '%".strtolower($contactname)."%' OR lower(p.firstname) like '%".strtolower($contactname)."%') "; $sortfield = "lower(p.name)"; $sortorder = "ASC"; } -if ($socid) { +if ($socid) +{ $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); $result = $db->query($sql); -if ($result) { + +if ($result) +{ $num = $db->num_rows(); $i = 0; - if ($sortorder == "DESC") { - $sortorder="ASC"; - } else { - $sortorder="DESC"; - } + if ($sortorder == "DESC") + { + $sortorder="ASC"; + } + else + { + $sortorder="DESC"; + } print "
| Nom | "; @@ -87,27 +96,28 @@ if ($result) { print 'Téléphone | '; print " | |||
| $obj->name | "; - print "$obj->firstname | "; - - print ' ';
- print "idp\">$obj->nom | \n";
-
- print ''.$obj->email.' | '; - - print ''.$obj->phone.' | '; - - print "idp&setcontact=$obj->cidp&action=create\">[Propal] | \n"; - print "$obj->name | "; + print "$obj->firstname | "; + + print ' ';
+ print "idp\">$obj->nom | \n";
+
+ print ''.$obj->email.' | '; + + print ''.$obj->phone.' | '; + + print "idp&setcontact=$obj->cidp&action=create\">[Propal] | \n"; + print "\n"; + $i++; + } print "
| "; - print ''.$menu[$i][1].''; + print " |
| ";
+ print ''.$menu[$i][1].'';
- for ($j = 2 ; $j < sizeof($menu[$i]) - 1 ; $j = $j +2) {
- print ' - '.$menu[$i][$j+1].''; + for ($j = 2 ; $j < sizeof($menu[$i]) - 1 ; $j = $j +2) + { + print ' - '.$menu[$i][$j+1].''; + } + print ' |
| "; print 'Societes'; - print ' |