From 0e8151fe9eb45bc895df2c3e208ce31c713eb804 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 27 Oct 2004 10:24:22 +0000 Subject: [PATCH] Debut de gestion de recherche dans PHProjekt --- htdocs/contact/index.php | 158 ++++++++++++++++++++++++++++++++------- 1 file changed, 130 insertions(+), 28 deletions(-) diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php index ee8929a2acb..eed3589bd5b 100644 --- a/htdocs/contact/index.php +++ b/htdocs/contact/index.php @@ -89,9 +89,14 @@ if (strlen($_GET["userid"])) // statut commercial $sql .= " WHERE p.fk_user=".$_GET["userid"]; } -if (strlen($_GET["begin"])) // filtre sur la premiere lettre du nom +if (strlen($_GET["search_nom"])) // filtre sur la premiere lettre du nom { - $sql .= " WHERE upper(p.name) like '".$_GET["begin"]."%'"; + $sql .= " WHERE upper(p.name) like '%".$_GET["search_nom"]."%'"; +} + +if (strlen($_GET["search_prenom"])) // filtre sur la premiere lettre du nom +{ + $sql .= " WHERE upper(p.firstname) like '%".$_GET["search_prenom"]."%'"; } if ($contactname) @@ -122,33 +127,9 @@ if ($result) print_barre_liste($titre ,$page, "index.php", '&begin='.$_GET["begin"].'&view='.$_GET["view"].'&userid='.$_GET["userid"], $sortfield, $sortorder,'',$num); - print "
"; - print "| *\n| "; - for ($ij = 65 ; $ij < 91; $ij++) { - print ""; - - if ($_GET["begin"] == chr($ij) ) - { - print ">" . chr($ij) . "<" ; - } - else - { - print chr($ij); - } - print " | "; - } - print "
"; - - if ($sortorder == "DESC") - { - $sortorder="ASC"; - } - else - { - $sortorder="DESC"; - } - print ''; + print '

'; + print '\n"; + + + + print ''; + print ''; + print ''; + print ''; + + + + + $var=True; while ($i < min($num,$limit)) { @@ -228,6 +225,111 @@ else dolibarr_print_error($db); } + +/* + * PhProjekt + * + * + */ + +if (2==1 && strlen($_GET["search_nom"]) OR strlen($_GET["search_prenom"])) +{ + + + $sortfield = "p.nachname"; + $sortorder = "ASC"; + + $sql = "SELECT p.vorname, p.nachname, p.firma, p.email"; + $sql .= " FROM phprojekt.contacts as p"; + $sql .= " WHERE upper(p.nachname) like '%".$_GET["search_nom"]."%'"; + + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1, $offset); + + +$result = $db->query($sql); + +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + + print '

'; print_liste_field_titre($langs->trans("Lastname"),"index.php","lower(p.name)", $begin); print ""; @@ -170,6 +151,22 @@ if ($result) } print "
'; + print ''; + print ''; + print ''; + print ' 
'; + print ''; + + print ''; + + if ($_GET["view"] == 'phone') + { + print ''; + print ''; + } + else + { + print ''; + } + + print "\n"; + $var=True; + while ($i < min($num,$limit)) + { + $obj = $db->fetch_object( $i); + + $var=!$var; + + print ""; + + print ''; + print ''; + + print '\n"; + + + print ''; + + if ($_GET["view"] == 'phone') + { + print ''; + + print ''; + } + else + { + print ''; + } + + print "\n"; + $i++; + } + print "
'; + print_liste_field_titre("Nom","projekt.php","lower(p.name)", $begin); + print ""; + print_liste_field_titre("Prénom","projekt.php","lower(p.firstname)", $begin); + print ""; + print_liste_field_titre("Société","projekt.php","lower(s.nom)", $begin); + print 'TéléphonePortableFaxemail
'; + print ''; + print img_file(); + print ' '.$obj->nachname.''.$obj->vorname.''; + print "idp\">$obj->firma'.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->phone_mobile).' '.dolibarr_print_phone($obj->fax).' '.$obj->email.' '; + if (!valid_email($obj->email)) + { + print "Email Invalide !"; + } + print '
"; + $db->free(); +} +else +{ + print $db->error(); + print "
".$sql; +} +} + + + + + $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$");