diff --git a/htdocs/contact.php b/htdocs/contact.php new file mode 100644 index 00000000000..9b523c37f21 --- /dev/null +++ b/htdocs/contact.php @@ -0,0 +1,144 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php3"); + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + +llxHeader(); +$db = new Db(); + +if ($sortorder == "") +{ + $sortorder="ASC"; +} +if ($sortfield == "") +{ + $sortfield="p.name"; +} + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des contacts",$page, $PHP_SELF); + + +/* + * + * Mode liste + * + * + */ + + +$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)) // statut commercial +{ + $sql .= " AND s.fk_stcomm=$stcomm"; +} + +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 +{ + $sql .= " AND ( lower(p.name) like '%".strtolower($contactname)."%' OR lower(p.firstname) like '%".strtolower($contactname)."%') "; + $sortfield = "lower(p.name)"; + $sortorder = "ASC"; +} + +if ($socid) +{ + $sql .= " AND s.idp = $socid"; +} + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); + +$result = $db->query($sql); + +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + if ($sortorder == "DESC") + { + $sortorder="ASC"; + } + else + { + $sortorder="DESC"; + } + print "

"; + print ""; + print ""; + print ''; + print "\n"; + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + + print ""; + print ""; + + print '\n"; + + print ''; + + print ''; + + print "\n"; + $i++; + } + print "
"; + print_liste_field_titre("Nom",$PHP_SELF,"lower(p.name)", $begin); + print ""; + 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 "emailTéléphone
$obj->name$obj->firstname '; + print "idp\">$obj->nom'.$obj->email.' '.$obj->phone.' 
"; + $db->free(); +} else { + print $db->error(); +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>