26 require
'../main.inc.php';
28 $langs->load(
"companies");
41 $socid = $user->socid;
44 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
45 $sortfield =
GETPOST(
"sortfield",
'alpha');
46 $sortorder =
GETPOST(
"sortorder",
'alpha');
48 if (empty($page) || $page == -1) { $page = 0; }
49 $offset = $limit * $page;
50 $pageprev = $page - 1;
51 $pagenext = $page + 1;
52 if (!$sortorder) $sortorder =
"ASC";
53 if (!$sortfield) $sortfield =
"p.name";
54 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
61 $sql =
"SELECT s.rowid as socid, s.nom as name, st.libelle as stcomm, p.rowid as cidp, p.lastname, p.firstname, p.email, p.phone";
62 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", sc.fk_soc, sc.fk_user ";
63 $sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"socpeople as p, ".MAIN_DB_PREFIX.
"c_stcomm as st";
64 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
65 $sql .=
" WHERE s.fk_stcomm = st.id";
66 $sql .=
" AND s.fournisseur = 1";
67 $sql .=
" AND s.rowid = p.fk_soc";
68 $sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
69 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
72 $sql .=
" AND s.fk_stcomm=$stcomm";
76 $sql .=
" AND p.name LIKE '$begin%'";
80 $sql .=
" AND p.name LIKE '%".strtolower($contactname).
"%'";
81 $sortfield =
"p.name";
86 $sql .=
" AND s.rowid = ".$socid;
89 $sql .=
" ORDER BY $sortfield $sortorder ";
90 $sql .= $db->plimit($limit, $offset);
92 $result = $db->query($sql);
95 $num = $db->num_rows($result);
97 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans(
"ListOfContacts") : $langs->trans(
"ListOfContactsAddresses"));
98 print_barre_liste($title.
" (".$langs->trans(
"Suppliers").
")", $page,
$_SERVER[
"PHP_SELF"],
"", $sortfield, $sortorder,
"", $num);
100 print '<table class="liste centpercent">';
101 print
'<tr class="liste_titre">';
103 print_liste_field_titre(
"Firstname", $_SERVER[
"PHP_SELF"],
"p.firstname", $begin,
"",
"", $sortfield, $sortorder);
110 while ($i < min($num, $limit))
112 $obj = $db->fetch_object($result);
114 print
'<tr class="oddeven">';
116 print
'<td><a href="'.DOL_URL_ROOT.
'/contact/card.php?id='.$obj->cidp.
'">'.
img_object($langs->trans(
"ShowContact"),
"contact").
' '.$obj->lastname.
'</a></td>';
117 print
'<td>'.$obj->firstname.
'</td>';
118 print
'<td><a href="'.DOL_URL_ROOT.
'/fourn/card.php?socid='.$obj->socid.
'">'.
img_object($langs->trans(
"ShowCompany"),
"company").
' '.$obj->name.
'</a></td>';
119 print
'<td>'.$obj->email.
'</td>';
120 print
'<td>'.$obj->phone.
'</td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...