dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
3  * Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
4  * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5  * Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
6  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
7  * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
8  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
29 require '../../main.inc.php';
30 
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
38 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
39 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
40 
41 // Load translation files required by the page
42 $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
43 
44 $action = GETPOST('action', 'aZ09');
45 $massaction = GETPOST('massaction', 'alpha');
46 $confirm = GETPOST('confirm', 'alpha');
47 $toselect = GETPOST('toselect', 'array');
48 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search
49 $optioncss = GETPOST('optioncss', 'alpha');
50 
51 $default_account = GETPOST('default_account', 'int');
52 
53 // Select Box
54 $mesCasesCochees = GETPOST('toselect', 'array');
55 
56 // Search Getpost
57 $search_societe = GETPOST('search_societe', 'alpha');
58 $search_lineid = GETPOST('search_lineid', 'int');
59 $search_ref = GETPOST('search_ref', 'alpha');
60 $search_invoice = GETPOST('search_invoice', 'alpha');
61 $search_label = GETPOST('search_label', 'alpha');
62 $search_desc = GETPOST('search_desc', 'alpha');
63 $search_amount = GETPOST('search_amount', 'alpha');
64 $search_account = GETPOST('search_account', 'alpha');
65 $search_vat = GETPOST('search_vat', 'alpha');
66 $search_date_startday = GETPOST('search_date_startday', 'int');
67 $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
68 $search_date_startyear = GETPOST('search_date_startyear', 'int');
69 $search_date_endday = GETPOST('search_date_endday', 'int');
70 $search_date_endmonth = GETPOST('search_date_endmonth', 'int');
71 $search_date_endyear = GETPOST('search_date_endyear', 'int');
72 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
73 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
74 $search_country = GETPOST('search_country', 'alpha');
75 $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
76 
77 // Load variable for pagination
78 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
79 $sortfield = GETPOST('sortfield', 'aZ09comma');
80 $sortorder = GETPOST('sortorder', 'aZ09comma');
81 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
82 if (empty($page) || $page < 0) {
83  $page = 0;
84 }
85 $offset = $limit * $page;
86 $pageprev = $page - 1;
87 $pagenext = $page + 1;
88 if (!$sortfield) {
89  $sortfield = "f.datef, f.ref, l.rowid";
90 }
91 if (!$sortorder) {
92  if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
93  $sortorder = "DESC";
94  }
95 }
96 
97 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
98 $hookmanager->initHooks(array('accountancycustomerlist'));
99 
100 $formaccounting = new FormAccounting($db);
101 $accountingAccount = new AccountingAccount($db);
102 
103 $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
104 
105 // Security check
106 if (!isModEnabled('accounting')) {
107  accessforbidden();
108 }
109 if ($user->socid > 0) {
110  accessforbidden();
111 }
112 if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
113  accessforbidden();
114 }
115 
116 
117 /*
118  * Actions
119  */
120 
121 if (GETPOST('cancel', 'alpha')) {
122  $action = 'list'; $massaction = '';
123 }
124 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
125  $massaction = '';
126 }
127 
128 $parameters = array();
129 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
130 if ($reshook < 0) {
131  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
132 }
133 
134 if (empty($reshook)) {
135  // Purge search criteria
136  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
137  $search_societe = '';
138  $search_lineid = '';
139  $search_ref = '';
140  $search_invoice = '';
141  $search_label = '';
142  $search_desc = '';
143  $search_amount = '';
144  $search_account = '';
145  $search_vat = '';
146  $search_date_startday = '';
147  $search_date_startmonth = '';
148  $search_date_startyear = '';
149  $search_date_endday = '';
150  $search_date_endmonth = '';
151  $search_date_endyear = '';
152  $search_date_start = '';
153  $search_date_end = '';
154  $search_country = '';
155  $search_tvaintra = '';
156  }
157 
158  // Mass actions
159  $objectclass = 'AccountingAccount';
160  $permissiontoread = $user->hasRight('accounting', 'read');
161  $permissiontodelete = $user->hasRight('accounting', 'delete');
162  $uploaddir = $conf->accounting->dir_output;
163  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
164 }
165 
166 
167 if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
168  $msg = '';
169 
170  //print '<div><span style="color:red">' . $langs->trans("Processing") . '...</span></div>';
171  if (!empty($mesCasesCochees)) {
172  $msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
173  $msg .= '<div class="detail">';
174  $cpt = 0;
175  $ok = 0;
176  $ko = 0;
177 
178  foreach ($mesCasesCochees as $maLigneCochee) {
179  $maLigneCourante = explode("_", $maLigneCochee);
180  $monId = $maLigneCourante[0];
181  $monCompte = GETPOST('codeventil'.$monId);
182 
183  if ($monCompte <= 0) {
184  $msg .= '<div><span style="color:red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
185  $ko++;
186  } else {
187  $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
188  $sql .= " SET fk_code_ventilation = ".((int) $monCompte);
189  $sql .= " WHERE rowid = ".((int) $monId);
190 
191  $accountventilated = new AccountingAccount($db);
192  $accountventilated->fetch($monCompte, '', 1);
193 
194  dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
195  if ($db->query($sql)) {
196  $msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
197  $ok++;
198  } else {
199  $msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
200  $ko++;
201  }
202  }
203 
204  $cpt++;
205  }
206  $msg .= '</div>';
207  $msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
208  }
209 }
210 
211 
212 
213 /*
214  * View
215  */
216 
217 $form = new Form($db);
218 $formother = new FormOther($db);
219 
220 llxHeader('', $langs->trans("Ventilation"));
221 
222 if (empty($chartaccountcode)) {
223  print $langs->trans("ErrorChartOfAccountSystemNotSelected");
224  // End of page
225  llxFooter();
226  $db->close();
227  exit;
228 }
229 
230 // Customer Invoice lines
231 $sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.situation_cycle_ref, f.fk_facture_source,";
232 $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.situation_percent, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
233 $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
234 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
235  $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
236  $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
237 } else {
238  $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
239  $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
240 }
241 $sql .= " p.tosell as status, p.tobuy as status_buy,";
242 $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
243 $sql .= " co.code as country_code, co.label as country_label,";
244 $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur,";
245 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
246  $sql .= " spe.accountancy_code_customer as code_compta_client,";
247  $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
248  $sql .= " spe.accountancy_code_sell as company_code_sell";
249 } else {
250  $sql .= " s.code_compta as code_compta_client,";
251  $sql .= " s.code_compta_fournisseur,";
252  $sql .= " s.accountancy_code_sell as company_code_sell";
253 }
254 $parameters = array();
255 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
256 $sql .= $hookmanager->resPrint;
257 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
258 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
259 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
260  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
261 }
262 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
263 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture";
264 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
265 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
266  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
267 }
268 $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
269 $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
270 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
271 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
272 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
273 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
274 
275 $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
276 $sql .= " AND l.product_type <= 2";
277 // Define begin binding date
278 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
279  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
280 }
281 // Add search filter like
282 if ($search_societe) {
283  $sql .= natural_search('s.nom', $search_societe);
284 }
285 if ($search_lineid) {
286  $sql .= natural_search("l.rowid", $search_lineid, 1);
287 }
288 if (strlen(trim($search_invoice))) {
289  $sql .= natural_search("f.ref", $search_invoice);
290 }
291 if (strlen(trim($search_ref))) {
292  $sql .= natural_search("p.ref", $search_ref);
293 }
294 if (strlen(trim($search_label))) {
295  $sql .= natural_search("p.label", $search_label);
296 }
297 if (strlen(trim($search_desc))) {
298  $sql .= natural_search("l.description", $search_desc);
299 }
300 if (strlen(trim($search_amount))) {
301  $sql .= natural_search("l.total_ht", $search_amount, 1);
302 }
303 if (strlen(trim($search_account))) {
304  $sql .= natural_search("aa.account_number", $search_account);
305 }
306 if (strlen(trim($search_vat))) {
307  $sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
308 }
309 if ($search_date_start) {
310  $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
311 }
312 if ($search_date_end) {
313  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
314 }
315 if (strlen(trim($search_country))) {
316  $arrayofcode = getCountriesInEEC();
317  $country_code_in_EEC = $country_code_in_EEC_without_me = '';
318  foreach ($arrayofcode as $key => $value) {
319  $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
320  if ($value != $mysoc->country_code) {
321  $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
322  }
323  }
324  if ($search_country == 'special_allnotme') {
325  $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
326  } elseif ($search_country == 'special_eec') {
327  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
328  } elseif ($search_country == 'special_eecnotme') {
329  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
330  } elseif ($search_country == 'special_noteec') {
331  $sql .= " AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
332  } else {
333  $sql .= natural_search("co.code", $search_country);
334  }
335 }
336 if (strlen(trim($search_tvaintra))) {
337  $sql .= natural_search("s.tva_intra", $search_tvaintra);
338 }
339 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
340  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
341 } else {
342  $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
343 }
344 $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
345 
346 // Add where from hooks
347 $parameters = array();
348 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
349 $sql .= $hookmanager->resPrint;
350 
351 $sql .= $db->order($sortfield, $sortorder);
352 
353 // Count total nb of records
354 $nbtotalofrecords = '';
355 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
356  $result = $db->query($sql);
357  $nbtotalofrecords = $db->num_rows($result);
358  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
359  $page = 0;
360  $offset = 0;
361  }
362 }
363 
364 $sql .= $db->plimit($limit + 1, $offset);
365 
366 dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
367 // MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso)
368 // This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security
369 if ($db->type == 'mysqli') {
370  $db->query("SET SQL_BIG_SELECTS=1");
371 }
372 
373 $result = $db->query($sql);
374 if ($result) {
375  $num_lines = $db->num_rows($result);
376  $i = 0;
377 
378  $arrayofselected = is_array($toselect) ? $toselect : array();
379 
380  $param = '';
381  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
382  $param .= '&contextpage='.urlencode($contextpage);
383  }
384  if ($limit > 0 && $limit != $conf->liste_limit) {
385  $param .= '&limit='.urlencode($limit);
386  }
387  if ($search_societe) {
388  $param .= '&search_societe='.urlencode($search_societe);
389  }
390  if ($search_lineid) {
391  $param .= '&search_lineid='.urlencode($search_lineid);
392  }
393  if ($search_date_startday) {
394  $param .= '&search_date_startday='.urlencode($search_date_startday);
395  }
396  if ($search_date_startmonth) {
397  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
398  }
399  if ($search_date_startyear) {
400  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
401  }
402  if ($search_date_endday) {
403  $param .= '&search_date_endday='.urlencode($search_date_endday);
404  }
405  if ($search_date_endmonth) {
406  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
407  }
408  if ($search_date_endyear) {
409  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
410  }
411  if ($search_invoice) {
412  $param .= '&search_invoice='.urlencode($search_invoice);
413  }
414  if ($search_ref) {
415  $param .= '&search_ref='.urlencode($search_ref);
416  }
417  if ($search_label) {
418  $param .= '&search_label='.urlencode($search_label);
419  }
420  if ($search_desc) {
421  $param .= '&search_desc='.urlencode($search_desc);
422  }
423  if ($search_amount) {
424  $param .= '&search_amount='.urlencode($search_amount);
425  }
426  if ($search_vat) {
427  $param .= '&search_vat='.urlencode($search_vat);
428  }
429  if ($search_country) {
430  $param .= "&search_country=".urlencode($search_country);
431  }
432  if ($search_tvaintra) {
433  $param .= "&search_tvaintra=".urlencode($search_tvaintra);
434  }
435 
436  $arrayofmassactions = array(
437  'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
438  ,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
439  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
440  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
441  );
442  //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
443  //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
444  if ($massaction !== 'set_default_account') {
445  $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
446  }
447 
448  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
449  print '<input type="hidden" name="action" value="ventil">';
450  if ($optioncss != '') {
451  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
452  }
453  print '<input type="hidden" name="token" value="'.newToken().'">';
454  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
455  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
456  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
457  print '<input type="hidden" name="page" value="'.$page.'">';
458 
459  print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
460 
461  if ($massaction == 'set_default_account') {
462  $formquestion[]=array('type' => 'other',
463  'name' => 'set_default_account',
464  'label' => $langs->trans("AccountancyCode"),
465  'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
466  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
467  }
468 
469  print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
470 
471  if (!empty($msg)) {
472  print $msg.'<br>';
473  }
474 
475  $moreforfilter = '';
476 
477  print '<div class="div-table-responsive">';
478  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
479 
480  // We add search filter
481  print '<tr class="liste_titre_filter">';
482  print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
483  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
484  print '<td class="liste_titre center">';
485  print '<div class="nowrap">';
486  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
487  print '</div>';
488  print '<div class="nowrap">';
489  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
490  print '</div>';
491  print '</td>';
492  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
493  print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
494  print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
495  print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
496  print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
497  print '<td class="liste_titre">';
498  print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
499  //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
500  print '</td>';
501  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
502  print '<td class="liste_titre"></td>';
503  print '<td class="liste_titre"></td>';
504  print '<td class="center liste_titre">';
505  $searchpicto = $form->showFilterButtons();
506  print $searchpicto;
507  print '</td>';
508  print "</tr>\n";
509 
510  print '<tr class="liste_titre">';
511  print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
512  print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
513  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
514  print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
515  //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
516  print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
517  print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
518  print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
519  print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
520  print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
521  print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
522  print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
523  print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
524  $checkpicto = '';
525  if ($massactionbutton) {
526  $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
527  }
528  print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
529  print "</tr>\n";
530 
531  $thirdpartystatic = new Societe($db);
532  $facture_static = new Facture($db);
533  $facture_static_det = new FactureLigne($db);
534  $product_static = new Product($db);
535 
536 
537  $accountingaccount_codetotid_cache = array();
538 
539  while ($i < min($num_lines, $limit)) {
540  $objp = $db->fetch_object($result);
541 
542  // product_type: 0 = service, 1 = product
543  // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
544  // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
545  $code_sell_l = '';
546  $code_sell_p = '';
547  $code_sell_t = '';
548 
549  $thirdpartystatic->id = $objp->socid;
550  $thirdpartystatic->name = $objp->name;
551  $thirdpartystatic->client = $objp->client;
552  $thirdpartystatic->fournisseur = $objp->fournisseur;
553  $thirdpartystatic->code_client = $objp->code_client;
554  $thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility
555  $thirdpartystatic->code_compta_client = $objp->code_compta_client;
556  $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
557  $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
558  $thirdpartystatic->email = $objp->email;
559  $thirdpartystatic->country_code = $objp->country_code;
560  $thirdpartystatic->tva_intra = $objp->tva_intra;
561  $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
562 
563  $product_static->ref = $objp->product_ref;
564  $product_static->id = $objp->product_id;
565  $product_static->type = $objp->type;
566  $product_static->label = $objp->product_label;
567  $product_static->status = $objp->status;
568  $product_static->status_buy = $objp->status_buy;
569  $product_static->accountancy_code_sell = $objp->code_sell;
570  $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
571  $product_static->accountancy_code_sell_export = $objp->code_sell_export;
572  $product_static->accountancy_code_buy = $objp->code_buy;
573  $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
574  $product_static->accountancy_code_buy_export = $objp->code_buy_export;
575  $product_static->tva_tx = $objp->tva_tx_prod;
576 
577  $facture_static->ref = $objp->ref;
578  $facture_static->id = $objp->facid;
579  $facture_static->type = $objp->ftype;
580  $facture_static->date = $db->jdate($objp->datef);
581  $facture_static->fk_facture_source = $objp->fk_facture_source;
582 
583  $facture_static_det->id = $objp->rowid;
584  $facture_static_det->total_ht = $objp->total_ht;
585  $facture_static_det->tva_tx = $objp->tva_tx_line;
586  $facture_static_det->vat_src_code = $objp->vat_src_code;
587  $facture_static_det->product_type = $objp->type_l;
588  $facture_static_det->desc = $objp->description;
589 
590  $accountingAccountArray = array(
591  'dom'=>$objp->aarowid,
592  'intra'=>$objp->aarowid_intra,
593  'export'=>$objp->aarowid_export,
594  'thirdparty' =>$objp->aarowid_thirdparty);
595 
596  $code_sell_p_notset = '';
597  $code_sell_t_notset = '';
598 
599  $suggestedid = 0;
600 
601  $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
602  if (!is_array($return) && $return<0) {
603  setEventMessage($accountingAccount->error, 'errors');
604  } else {
605  $suggestedid=$return['suggestedid'];
606  $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
607  $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
608  $code_sell_l=$return['code_l'];
609  $code_sell_p=$return['code_p'];
610  $code_sell_t=$return['code_t'];
611  }
612  //var_dump($return);
613 
614  if (!empty($code_sell_p)) {
615  // Value was defined previously
616  } else {
617  $code_sell_p_notset = 'color:orange';
618  }
619  if (empty($code_sell_l) && empty($code_sell_p)) {
620  $code_sell_p_notset = 'color:red';
621  }
622  if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
623  $code_sell_p_notset = 'color:orange';
624  }
625 
626  // $code_sell_l is now default code of product/service
627  // $code_sell_p is now code of product/service
628  // $code_sell_t is now code of thirdparty
629  //var_dump($code_sell_l.' - '.$code_sell_p.' - '.$code_sell_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
630 
631  print '<tr class="oddeven">';
632 
633  // Line id
634  print '<td>'.$facture_static_det->id.'</td>';
635 
636  // Ref Invoice
637  print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
638 
639  print '<td class="center">'.dol_print_date($facture_static->date, 'day').'</td>';
640 
641  // Ref Product
642  print '<td class="tdoverflowmax100">';
643  if ($product_static->id > 0) {
644  print $product_static->getNomUrl(1);
645  }
646  if ($product_static->label) {
647  print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
648  }
649  print '</td>';
650 
651  // Description of line
652  print '<td class="tdoverflowonsmartphone small">';
653  $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
654  $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
655  print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
656  print '</td>';
657 
658  // Amount
659  print '<td class="right nowraponall amount">';
660 
661  // Create a compensation rate for old situation invoice feature.
662  $situation_ratio = 1;
663  if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
664  if ($objp->situation_cycle_ref) {
665  // Avoid divide by 0
666  if ($objp->situation_percent == 0) {
667  $situation_ratio = 0;
668  } else {
669  $line = new FactureLigne($db);
670  $line->fetch($objp->rowid);
671 
672  // Situation invoices handling
673  $prev_progress = $line->get_prev_progress($objp->facid);
674 
675  $situation_ratio = ($objp->situation_percent - $prev_progress) / $objp->situation_percent;
676  }
677  }
678  print price($objp->total_ht * $situation_ratio);
679  } else {
680  print price($objp->total_ht);
681  }
682  print '</td>';
683 
684  // Vat rate
685  $code_vat_differ = '';
686  if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
687  $code_vat_differ = 'warning bold';
688  }
689  print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
690  print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : ''));
691  print '</td>';
692 
693  // Thirdparty
694  print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'customer').'</td>';
695 
696  // Country
697  $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label;
698  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelcountry).'">';
699  print dol_escape_htmltag($labelcountry);
700  print '</td>';
701 
702  // VAT Num
703  print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
704 
705  // Found accounts
706  print '<td class="small">';
707  // First show default account for any products
708  $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
709  $shelp = ''; $ttype = 'help';
710  if ($suggestedaccountingaccountbydefaultfor == 'eec') {
711  $shelp .= $langs->trans("SaleEEC");
712  } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
713  $shelp = $langs->trans("SaleEECWithVAT");
714  } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
715  $shelp = $langs->trans("SaleEECWithoutVATNumber");
716  $ttype = 'warning';
717  } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
718  $shelp .= $langs->trans("SaleExport");
719  }
720  $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>');
721  print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
722  // Now show account for product
723  if ($product_static->id > 0) {
724  print '<br>';
725  $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
726  $shelp = ''; $ttype = 'help';
727  if ($suggestedaccountingaccountfor == 'eec') {
728  $shelp = $langs->trans("SaleEEC");
729  } elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
730  $shelp = $langs->trans("SaleEECWithVAT");
731  } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
732  $shelp = $langs->trans("SaleEECWithoutVATNumber");
733  $ttype = 'warning';
734  } elseif ($suggestedaccountingaccountfor == 'export') {
735  $shelp = $langs->trans("SaleExport");
736  }
737  $s .= (empty($code_sell_p) ? '<span style="'.$code_sell_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_sell_p));
738  print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
739  } else {
740  print '<br>';
741  $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
742  $shelp = '';
743  $s .= $langs->trans("NotDefined");
744  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
745  }
746  if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
747  print '<br>';
748  $s = '3. '.(($facture_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
749  $shelp = '';
750  $s .= ($code_sell_t > 0 ? length_accountg($code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>');
751  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
752  }
753  print '</td>';
754 
755  // Suggested accounting account
756  print '<td>';
757  print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth150 maxwidthonsmartphone', 'cachewithshowemptyone');
758  print '</td>';
759 
760  // Column with checkbox
761  print '<td class="center">';
762  $ischecked = 0;
763  if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
764  $ischecked = 1;
765  }
766 
767  if (!empty($toselect)) {
768  $ischecked = 0;
769  if (in_array($objp->rowid."_".$i, $toselect)) {
770  $ischecked=1;
771  }
772  }
773 
774  print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
775  print '</td>';
776 
777  print '</tr>';
778  $i++;
779  }
780  if ($num_lines == 0) {
781  print '<tr><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
782  }
783 
784  print '</table>';
785  print "</div>";
786 
787  print '</form>';
788 } else {
789  print $db->error();
790 }
791 if ($db->type == 'mysqli') {
792  $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
793 }
794 
795 // Add code to auto check the box when we select an account
796 print '<script type="text/javascript">
797 jQuery(document).ready(function() {
798  jQuery(".codeventil").change(function() {
799  var s=$(this).attr("id").replace("codeventil", "")
800  console.log(s+" "+$(this).val());
801  if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
802  else jQuery(".checkforselect"+s).prop("checked", true);
803  });
804 });
805 </script>';
806 
807 // End of page
808 llxFooter();
809 $db->close();
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage accounting accounts.
Class to manage invoices.
const TYPE_REPLACEMENT
Replacement invoice.
const TYPE_SITUATION
Situation invoice.
const TYPE_DEPOSIT
Deposit invoice.
const TYPE_CREDIT_NOTE
Credit note invoice.
Class to manage invoice lines.
Class to manage generation of HTML components for accounting management.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
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.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.