Le libell des contacts dcrit si il s'agit d'une liste de contact client-prospet seulement, fournisseur ou tout type.

Les raccourcis alphabet sont prsent sur cette page  l'identique des raccourcis sur la page des contacts fournisseurs.
This commit is contained in:
Laurent Destailleur 2004-01-24 17:34:32 +00:00
parent 34f0313a4f
commit 90732627b5

View File

@ -22,6 +22,8 @@
*/
require("./pre.inc.php");
llxHeader();
/*
* Sécurité accés client
*/
@ -31,8 +33,6 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
llxHeader();
if ($sortorder == "")
{
$sortorder="ASC";
@ -46,6 +46,15 @@ if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
if ($type == "c") {
$label = " prospects/clients";
}
if ($type == "f") {
$label = " fournisseurs";
}
/*
*
* Mode liste
@ -54,10 +63,18 @@ $offset = $limit * $page ;
*/
$sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone ";
$sql .= "FROM llx_societe as s, llx_socpeople as p, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";
$sql .= " FROM llx_societe as s, llx_socpeople as p, c_stcomm as st";
$sql .= " WHERE s.fk_stcomm = st.id AND s.idp = p.fk_soc";
if (strlen($stcomm)) // statut commercial
{
if ($type == "c") {
$sql .= " AND s.client = 1";
}
if ($type == "f") {
$sql .= " AND s.fournisseur = 1";
}
if (strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=$stcomm";
}
@ -66,36 +83,48 @@ 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
if ($_GET[contactname]) // acces a partir du module de recherche
{
$sql .= " AND ( lower(p.name) like '%".strtolower($contactname)."%' OR lower(p.firstname) like '%".strtolower($contactname)."%') ";
$sql .= " AND ( lower(p.name) like '%".strtolower($_GET[contactname])."%' OR lower(p.firstname) like '%".strtolower($_GET[contactname])."%') ";
$sortfield = "lower(p.name)";
$sortorder = "ASC";
}
if ($socid)
{
if ($socid) {
$sql .= " AND s.idp = $socid";
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit+1, $offset);
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
$result = $db->query($sql);
if ($result)
{
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Liste des contacts",$page, $PHP_SELF,"",$sortfield,$sortorder,"",$num);
if ($sortorder == "DESC")
{
$sortorder="ASC";
}
else
{
$sortorder="DESC";
}
print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print_barre_liste("Liste des contacts $label",$page, $PHP_SELF, "",$sortfield,$sortorder,"",$num);
print "<DIV align=\"center\">";
print "| <A href=\"$PHP_SELF?type=$type&page=$pageprev&stcomm=$stcomm&sortfield=$sortfield&sortorder=$sortorder&aclasser=$aclasser&coord=$coord\">*</A>\n| ";
for ($i = 65 ; $i < 91; $i++) {
print "<A href=\"$PHP_SELF?type=$type&begin=" . chr($i) . "&stcomm=$stcomm\" class=\"T3\">";
if ($begin == chr($i) ) {
print "<b>-&gt;" . chr($i) . "&lt;-</b>" ;
} else {
print chr($i) ;
}
print "</A> | ";
}
print "</div>";
if ($sortorder == "DESC") {
$sortorder="ASC";
} else {
$sortorder="DESC";
}
print '<p><TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
print "<TR class=\"liste_titre\">";
print "<TD>";
print_liste_field_titre("Nom",$PHP_SELF,"lower(p.name)", $begin);
@ -107,6 +136,7 @@ if ($result)
print '<TD>Téléphone</TD><td>&nbsp;</td>';
print "</TR>\n";
$var=True;
$i = 0;
while ($i < min($num,$limit))
{
$obj = $db->fetch_object( $i);
@ -118,7 +148,7 @@ if ($result)
print '<TD><a href="'.DOL_URL_ROOT.'/comm/people.php?contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->name.'</a></TD>';
print "<TD>$obj->firstname</TD>";
print '<TD><a href="contact.php?socid='.$obj->idp.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0" alt="filtrer"></a>&nbsp;';
print '<TD><a href="contact.php?type='.$type.'&socid='.$obj->idp.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0" alt="filtrer"></a>&nbsp;';
print "<a href=\"fiche.php?socid=$obj->idp\">$obj->nom</A></td>\n";
print '<td><a href="action/fiche.php?action=create&actionid=4&contactid='.$obj->cidp.'&socid='.$obj->idp.'">'.$obj->email.'</a>&nbsp;</td>';
@ -136,7 +166,7 @@ if ($result)
print "</TR>\n";
$i++;
}
print "</TABLE>";
print "</TABLE></p>";
$db->free();
} else {
print $db->error();