Look: Limite longueur nom société sur liste contacts
This commit is contained in:
parent
f3f63c9480
commit
3171b06a76
@ -19,10 +19,8 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/contact/index.php
|
\file htdocs/contact/index.php
|
||||||
\ingroup societe
|
\ingroup societe
|
||||||
@ -95,181 +93,180 @@ $sql .= "WHERE 1=1 ";
|
|||||||
|
|
||||||
if ($_GET["userid"]) // statut commercial
|
if ($_GET["userid"]) // statut commercial
|
||||||
{
|
{
|
||||||
$sql .= " AND p.fk_user=".$_GET["userid"];
|
$sql .= " AND p.fk_user=".$_GET["userid"];
|
||||||
}
|
}
|
||||||
if ($search_nom) // filtre sur le nom
|
if ($search_nom) // filtre sur le nom
|
||||||
{
|
{
|
||||||
$sql .= " AND upper(p.name) like '%".$search_nom."%'";
|
$sql .= " AND upper(p.name) like '%".$search_nom."%'";
|
||||||
}
|
}
|
||||||
if ($search_prenom) // filtre sur le prenom
|
if ($search_prenom) // filtre sur le prenom
|
||||||
{
|
{
|
||||||
$sql .= " AND upper(p.firstname) like '%".$search_prenom."%'";
|
$sql .= " AND upper(p.firstname) like '%".$search_prenom."%'";
|
||||||
}
|
}
|
||||||
if ($search_societe) // filtre sur la societe
|
if ($search_societe) // filtre sur la societe
|
||||||
{
|
{
|
||||||
$sql .= " AND upper(s.nom) like '%".$search_societe."%'";
|
$sql .= " AND upper(s.nom) like '%".$search_societe."%'";
|
||||||
}
|
}
|
||||||
if ($search_email) // filtre sur l'email
|
if ($search_email) // filtre sur l'email
|
||||||
{
|
{
|
||||||
$sql .= " AND upper(p.email) like '%".$search_email."%'";
|
$sql .= " AND upper(p.email) like '%".$search_email."%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type == "f") // filtre sur type
|
if ($type == "f") // filtre sur type
|
||||||
{
|
{
|
||||||
$sql .= " AND fournisseur = 1";
|
$sql .= " AND fournisseur = 1";
|
||||||
}
|
}
|
||||||
if ($type == "c") // filtre sur type
|
if ($type == "c") // filtre sur type
|
||||||
{
|
{
|
||||||
$sql .= " AND client = 1";
|
$sql .= " AND client = 1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contactname)
|
if ($contactname)
|
||||||
{
|
{
|
||||||
$sql .= " AND (p.name like '%".$contactname."%' OR p.firstname like '%".$contactname."%') ";
|
$sql .= " AND (p.name like '%".$contactname."%' OR p.firstname like '%".$contactname."%') ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
$sql .= " AND s.idp = $socid";
|
$sql .= " AND s.idp = $socid";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_GET["view"] == "recent")
|
if($_GET["view"] == "recent")
|
||||||
{
|
{
|
||||||
$sql .= " ORDER BY p.datec DESC " . $db->plimit( $limit + 1, $offset);
|
$sql .= " ORDER BY p.datec DESC " . $db->plimit( $limit + 1, $offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1, $offset);
|
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
print_barre_liste($titre ,$page, "index.php", '&begin='.$_GET["begin"].'&view='.$_GET["view"].'&userid='.$_GET["userid"], $sortfield, $sortorder,'',$num);
|
print_barre_liste($titre ,$page, "index.php", '&begin='.$_GET["begin"].'&view='.$_GET["view"].'&userid='.$_GET["userid"], $sortfield, $sortorder,'',$num);
|
||||||
|
|
||||||
|
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
if ($contactname)
|
if ($contactname)
|
||||||
{
|
{
|
||||||
print $langs->trans("Filter")." (".$langs->trans("Lastname")." ".$langs->trans("or")." ".$langs->trans("Firstname")."): $contactname";
|
print $langs->trans("Filter")." (".$langs->trans("Lastname")." ".$langs->trans("or")." ".$langs->trans("Firstname")."): $contactname";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ligne des titres
|
// Ligne des titres
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Lastname"),"index.php","p.name", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
print_liste_field_titre($langs->trans("Lastname"),"index.php","p.name", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
||||||
print_liste_field_titre($langs->trans("Firstname"),"index.php","p.firstname", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
print_liste_field_titre($langs->trans("Firstname"),"index.php","p.firstname", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
||||||
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
||||||
print '<td class="liste_titre">'.$langs->trans("Phone").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Phone").'</td>';
|
||||||
|
|
||||||
if ($_GET["view"] == 'phone')
|
if ($_GET["view"] == 'phone')
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">'.$langs->trans("Mobile").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Mobile").'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans("Fax").'</td>';
|
print '<td class="liste_titre">'.$langs->trans("Fax").'</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print_liste_field_titre($langs->trans("EMail"),"index.php","p.email", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
print_liste_field_titre($langs->trans("EMail"),"index.php","p.email", $begin, "&type=$type&view=$view&search_nom=$search_nom&search_prenom=$search_prenom&search_societe=$search_societe&search_email=$search_email", "", $sortfield);
|
||||||
}
|
}
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Ligne des champs de filtres
|
// Ligne des champs de filtres
|
||||||
print '<form method="post" action="index.php">';
|
print '<form method="post" action="index.php">';
|
||||||
print '<input type="hidden" name="view" value="'.$view.'">';
|
print '<input type="hidden" name="view" value="'.$view.'">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="search_nom" size="12" value="'.$search_nom.'">';
|
print '<input class="flat" type="text" name="search_nom" size="12" value="'.$search_nom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="search_prenom" size="10" value="'.$search_prenom.'">';
|
print '<input class="flat" type="text" name="search_prenom" size="10" value="'.$search_prenom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="search_societe" size="14" value="'.$search_societe.'">';
|
print '<input class="flat" type="text" name="search_societe" size="14" value="'.$search_societe.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($_GET["view"] == 'phone')
|
if ($_GET["view"] == 'phone')
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="search_email" size="12" value="'.$search_email.'">';
|
print '<input class="flat" type="text" name="search_email" size="12" value="'.$search_email.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
|
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
|
||||||
print ' <input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" alt="'.$langs->trans("RemoveFilter").'">';
|
print ' <input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" alt="'.$langs->trans("RemoveFilter").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
$var=!$var;
|
||||||
|
|
||||||
print '<td valign="center">';
|
print "<tr $bc[$var]>";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">';
|
|
||||||
print img_object($langs->trans("ShowContact"),"contact");
|
|
||||||
print '</a> <a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.$obj->name.'</a></td>';
|
|
||||||
print '<td>'.$obj->firstname.'</td>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">';
|
|
||||||
print img_object($langs->trans("ShowCompany"),"company");
|
|
||||||
print '</a> <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 valign="center">';
|
||||||
{
|
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">';
|
||||||
print '<td>'.dolibarr_print_phone($obj->phone_mobile).' </td>';
|
print img_object($langs->trans("ShowContact"),"contact");
|
||||||
|
print ' '.$obj->name.'</a></td>';
|
||||||
print '<td colspan="2">'.dolibarr_print_phone($obj->fax).' </td>';
|
print '<td>'.$obj->firstname.'</td>';
|
||||||
}
|
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">';
|
||||||
else
|
print img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).'</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>';
|
||||||
print '<td colspan="2">';
|
|
||||||
if (! $obj->email) {
|
if ($_GET["view"] == 'phone')
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
elseif (! ValidEmail($obj->email))
|
|
||||||
{
|
{
|
||||||
print "Email Invalide !";
|
print '<td>'.dolibarr_print_phone($obj->phone_mobile,$obj->fp_pays).' </td>';
|
||||||
}
|
|
||||||
else {
|
|
||||||
print '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
print '<td colspan="2">'.dolibarr_print_phone($obj->fax,$obj->fp_pays).' </td>';
|
||||||
$i++;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td colspan="2">';
|
||||||
|
if (! $obj->email) {
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
elseif (! ValidEmail($obj->email))
|
||||||
|
{
|
||||||
|
print "Email Invalide !";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user