Fix: Possibilit d'utiliser le filtre sur plus d'un champ dans la liste des contacts.
This commit is contained in:
parent
dafa165943
commit
707a48ef5a
@ -220,7 +220,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
||||
|
||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
@ -232,7 +232,8 @@ if ($_GET["action"] == 'create')
|
||||
print '<tr><td>Contact facturation</td><td colspan="5"><select name="facturation"><option value="0">Non<option value="1">Oui</select></td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="6"><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
|
||||
print "</table>";
|
||||
print "</table><br>";
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
@ -273,7 +274,7 @@ elseif ($_GET["action"] == 'edit')
|
||||
|
||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||
|
||||
print '<tr><td>CP Ville</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80"> <input name="cp" type="text" size="20" maxlength="80"></td>';
|
||||
|
||||
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.$contact->fax.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td colspan="5"><input name="email" type="text" size="50" maxlength="80" value="'.$contact->email.'"></td></tr>';
|
||||
@ -344,11 +345,6 @@ else
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
if ($contact->jabberid)
|
||||
print 'Jabber : '.$contact->jabberid ."<br>";
|
||||
|
||||
@ -80,28 +80,35 @@ $titre = "Liste des contacts $text";
|
||||
*/
|
||||
|
||||
$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 ".MAIN_DB_PREFIX."socpeople as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (s.idp = p.fk_soc)";
|
||||
|
||||
$sql .= "FROM ".MAIN_DB_PREFIX."socpeople as p ";
|
||||
$sql .= "LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (s.idp = p.fk_soc) ";
|
||||
|
||||
$sql .= "WHERE 1=1 ";
|
||||
if (strlen($_GET["userid"])) // statut commercial
|
||||
{
|
||||
$sql .= " WHERE p.fk_user=".$_GET["userid"];
|
||||
$sql .= " AND p.fk_user=".$_GET["userid"];
|
||||
}
|
||||
|
||||
if (strlen($_GET["search_nom"])) // filtre sur la premiere lettre du nom
|
||||
if (strlen($_GET["search_nom"])) // filtre sur le nom
|
||||
{
|
||||
$sql .= " WHERE upper(p.name) like '%".$_GET["search_nom"]."%'";
|
||||
$sql .= " AND upper(p.name) like '%".$_GET["search_nom"]."%'";
|
||||
}
|
||||
|
||||
if (strlen($_GET["search_prenom"])) // filtre sur la premiere lettre du nom
|
||||
if (strlen($_GET["search_prenom"])) // filtre sur le prenom
|
||||
{
|
||||
$sql .= " WHERE upper(p.firstname) like '%".$_GET["search_prenom"]."%'";
|
||||
$sql .= " AND upper(p.firstname) like '%".$_GET["search_prenom"]."%'";
|
||||
}
|
||||
if (strlen($_GET["search_societe"])) // filtre sur la societe
|
||||
{
|
||||
$sql .= " AND upper(s.nom) like '%".$_GET["search_societe"]."%'";
|
||||
}
|
||||
if (strlen($_GET["search_email"])) // filtre sur l'email
|
||||
{
|
||||
$sql .= " AND upper(p.email) like '%".$_GET["search_email"]."%'";
|
||||
}
|
||||
|
||||
if ($contactname)
|
||||
{
|
||||
$sql .= " WHERE (p.name like '%".$contactname."%' OR p.firstname like '%".$contactname."%') ";
|
||||
$sql .= " AND (p.name like '%".$contactname."%' OR p.firstname like '%".$contactname."%') ";
|
||||
}
|
||||
|
||||
if ($socid)
|
||||
@ -130,11 +137,11 @@ if ($result)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Ligne des titres
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Lastname"),"index.php","lower(p.name)", $begin);
|
||||
print_liste_field_titre($langs->trans("Firstname"),"index.php","lower(p.firstname)", $begin);
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","lower(s.nom)", $begin);
|
||||
|
||||
print_liste_field_titre($langs->trans("Lastname"),"index.php","p.name", $begin, "", "", $sortfield);
|
||||
print_liste_field_titre($langs->trans("Firstname"),"index.php","p.firstname", $begin, "", "", $sortfield);
|
||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom", $begin, "", "", $sortfield);
|
||||
print '<td>'.$langs->trans("Phone").'</td>';
|
||||
|
||||
if ($_GET["view"] == 'phone')
|
||||
@ -144,23 +151,46 @@ if ($result)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>'.$langs->trans("EMail").'</td>';
|
||||
print_liste_field_titre($langs->trans("EMail"),"index.php","p.email", $begin, "", "", $sortfield);
|
||||
}
|
||||
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ligne des champs de filtres
|
||||
print '<form method="get" action="index.php">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td valign="right">';
|
||||
print '<input type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
|
||||
print '<td>';
|
||||
print '<input class="flat" type="text" name="search_nom" value="'.$_GET["search_nom"].'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input class="flat" type="text" name="search_prenom" value="'.$_GET["search_prenom"].'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input class="flat" type="text" name="search_societe" value="'.$_GET["search_societe"].'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td valign="right">';
|
||||
print '<input type="text" name="search_prenom" value="'.$_GET["search_prenom"].'">';
|
||||
print '</td><td colspan="2"><input type="submit"></td><td> </td></tr>';
|
||||
|
||||
|
||||
|
||||
if ($_GET["view"] == 'phone')
|
||||
{
|
||||
print '<td>';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<input class="flat" type="text" name="search_email" value="'.$_GET["search_email"].'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td><input class="button" type="submit" value="'.$langs->trans("Search").'"></td>';
|
||||
print '</tr>';
|
||||
print '</form>';
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$limit))
|
||||
@ -175,27 +205,19 @@ if ($result)
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">';
|
||||
print img_file();
|
||||
print '</a> <a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.$obj->name.'</a></td>';
|
||||
print "<td>$obj->firstname</TD>";
|
||||
|
||||
print '<td>';
|
||||
if ($obj->nom)
|
||||
{
|
||||
print '<a href="contact.php?socid='.$obj->idp.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0" alt="Filtre"></a> ';
|
||||
}
|
||||
print "<a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
|
||||
|
||||
|
||||
print '<td>'.$obj->firstname.'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actionid=1&contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.dolibarr_print_phone($obj->phone).'</a> </td>';
|
||||
|
||||
if ($_GET["view"] == 'phone')
|
||||
{
|
||||
print '<td>'.dolibarr_print_phone($obj->phone_mobile).' </td>';
|
||||
|
||||
print '<td>'.dolibarr_print_phone($obj->fax).' </td>';
|
||||
print '<td colspan="2">'.dolibarr_print_phone($obj->fax).' </td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<td colspan="2">';
|
||||
if (! $obj->email) {
|
||||
print ' ';
|
||||
}
|
||||
@ -224,10 +246,9 @@ else
|
||||
/*
|
||||
* PhProjekt
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (2==1 && strlen($_GET["search_nom"]) OR strlen($_GET["search_prenom"]))
|
||||
if (2==1 && (strlen($_GET["search_nom"]) OR strlen($_GET["search_prenom"])))
|
||||
{
|
||||
|
||||
|
||||
@ -319,12 +340,11 @@ else
|
||||
print $db->error();
|
||||
print "<br>".$sql;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user