28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
40$action =
GETPOST(
'action',
'aZ09');
43if ($user->socid > 0) {
45 $socid = $user->socid;
48if (!$user->hasRight(
'facture',
'lire')) {
53$langs->load(
"companies");
58$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
61if (empty($page) || $page == -1) {
64$offset = $limit * $page;
78if ($action ==
'note' && $user->hasRight(
'societe',
'lire')) {
79 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"societe SET note = '".$db->escape($note).
"' WHERE rowid=".((int) $socid);
80 $result = $db->query($sql);
90$thirdpartystatic =
new Societe($db);
92if ($mode ==
'search') {
93 $resql = $db->query($sql);
95 if ($db->num_rows($resql) == 1) {
96 $obj = $db->fetch_object($resql);
106$sql =
"SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
107$sql .=
", st.libelle as stcomm, s.prefix_comm, s.code_client as code_client_compta, s.code_compta ";
108if (!$user->hasRight(
'societe',
'client',
'voir')) {
109 $sql .=
", sc.fk_soc, sc.fk_user ";
111$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"c_stcomm as st";
112if (!$user->hasRight(
'societe',
'client',
'voir')) {
113 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
115$sql .=
" WHERE s.fk_stcomm = st.id AND s.client in (1, 3)";
116$sql .=
" AND s.entity IN (".getEntity(
'societe').
")";
117if (!$user->hasRight(
'societe',
'client',
'voir')) {
118 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
121 $sql .=
" AND s.fk_stcomm=".((int) $stcomm);
129if (
GETPOST(
"search_code_client")) {
133 $sql .=
" AND s.rowid = ".((int) $socid);
135$sql .= $db->order($sortfield, $sortorder);
136$sql .= $db->plimit(
$conf->liste_limit + 1, $offset);
139$resql = $db->query($sql);
141 $num = $db->num_rows($resql);
144 $langs->load(
'commercial');
146 print_barre_liste($langs->trans(
"Customers"), $page, $_SERVER[
"PHP_SELF"],
"", $sortfield, $sortorder,
'', $num);
148 print
'<form method="GET" action="'.$_SERVER[
"PHP_SELF"].
'">';
150 print
'<table class="liste centpercent">';
151 print
'<tr class="liste_titre">';
153 print_liste_field_titre(
"Company", $_SERVER[
"PHP_SELF"],
"s.nom",
"",
"",
'valign="center"', $sortfield, $sortorder);
154 print_liste_field_titre(
"Town", $_SERVER[
"PHP_SELF"],
"s.town",
"",
"",
'valign="center"', $sortfield, $sortorder);
155 print_liste_field_titre(
"CustomerCode", $_SERVER[
"PHP_SELF"],
"s.code_client",
"",
"",
'', $sortfield, $sortorder,
'left ');
156 print_liste_field_titre(
"AccountancyCode", $_SERVER[
"PHP_SELF"],
"s.code_compta",
"",
"",
'', $sortfield, $sortorder,
'left ');
157 print_liste_field_titre(
"DateCreation", $_SERVER[
"PHP_SELF"],
"datec", $addu,
"",
'', $sortfield, $sortorder,
'right ');
161 print
'<tr class="liste_titre">';
163 print
'<td class="liste_titre left">';
164 print
'<input class="flat" type="text" name="search_nom" value="'.GETPOST(
"search_nom").
'"></td>';
166 print
'<td class="liste_titre"> </td>';
168 print
'<td class="liste_titre left">';
169 print
'<input class="flat" type="text" size="10" name="search_code_client" value="'.GETPOST(
"search_code_client").
'">';
172 print
'<td class="liste_titre left">';
173 print
'<input class="flat" type="text" size="10" name="search_compta" value="'.GETPOST(
"search_compta").
'">';
176 print
'<td colspan="2" class="liste_titre right">';
177 print
'<input type="image" class="liste_titre" src="'.img_picto($langs->trans(
"Search"),
'search.png',
'', 0, 1).
'" name="button_search" value="'.
dol_escape_htmltag($langs->trans(
"Search")).
'" title="'.
dol_escape_htmltag($langs->trans(
"Search")).
'">';
181 while ($i < min($num,
$conf->liste_limit)) {
182 $obj = $db->fetch_object($resql);
184 print
'<tr class="oddeven">';
186 $thirdpartystatic->id = $obj->rowid;
187 $thirdpartystatic->name = $obj->name;
188 $thirdpartystatic->client = $obj->client;
189 print $thirdpartystatic->getNomUrl(1,
'compta');
191 print
'<td>'.dolPrintLabel($obj->town).
'</td>';
192 print
'<td class="left">'.dolPrintLabel($obj->code_client).
'</td>';
193 print
'<td class="left">'.dolPrintLabel($obj->code_compta_client).
'</td>';
194 print
'<td class="right">'.dol_print_date($db->jdate($obj->datec)).
'</td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.