diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php index afb4d84ed34..d686ebb3780 100644 --- a/htdocs/contact/index.php +++ b/htdocs/contact/index.php @@ -47,7 +47,14 @@ if ($page < 0) { $page = 0 ; } $limit = $conf->liste_limit; $offset = $limit * $page ; -print_barre_liste("Liste des contacts",$page, $PHP_SELF, '', $sortfield, $sortorder); +if ($_GET["view"] == 'phone') +{ + $titre = "Liste des contacts (Vue téléphone)"; +} +else +{ + $titre = "Liste des contacts"; +} /* * @@ -56,7 +63,7 @@ print_barre_liste("Liste des contacts",$page, $PHP_SELF, '', $sortfield, $sortor * */ -$sql = "SELECT s.idp, s.nom, p.idp as cidp, p.name, p.firstname, p.email, p.phone "; +$sql = "SELECT s.idp, s.nom, p.idp as cidp, p.name, p.firstname, p.email, p.phone, p.phone_mobile, p.fax "; $sql .= "FROM llx_socpeople as p"; $sql .= " LEFT JOIN llx_societe as s ON (s.idp = p.fk_soc)"; @@ -85,11 +92,11 @@ if ($socid) if($_GET["view"] == "recent") { - $sql .= " ORDER BY p.datec DESC " . $db->plimit( $limit, $offset); + $sql .= " ORDER BY p.datec DESC " . $db->plimit( $limit + 1, $offset); } else { - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); + $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1, $offset); } $result = $db->query($sql); @@ -98,6 +105,8 @@ if ($result) { $num = $db->num_rows(); $i = 0; + + print_barre_liste($titre ,$page, $PHP_SELF, '&view='.$_GET["view"].'&userid='.$_GET["userid"], $sortfield, $sortorder,'',$num); if ($sortorder == "DESC") { @@ -107,7 +116,7 @@ if ($result) { $sortorder="DESC"; } - print "
| "; print_liste_field_titre("Nom",$PHP_SELF,"lower(p.name)", $begin); @@ -115,11 +124,24 @@ if ($result) print_liste_field_titre("Prénom",$PHP_SELF,"lower(p.firstname)", $begin); print " | "; print_liste_field_titre("Société",$PHP_SELF,"lower(s.nom)", $begin); - print " | Téléphone | '; + print ''; + + print 'Téléphone | '; + + + if ($_GET["view"] == 'phone') + { + print 'Portable | '; + print 'Fax | '; + } + else + { + print ''.$obj->email.' | '; - print ''.$obj->phone.' | '; + print ''.$obj->phone.' | '; + + if ($_GET["view"] == 'phone') + { + print ''.$obj->phone_mobile.' | '; + + print ''.$obj->fax.' | '; + + } + else + { + print ''.$obj->email.' | '; + } + print "\n"; $i++; }