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