dolibarr  18.0.0-alpha
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  if (!empty($mesCasesCochees)) {
174  $msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
175  $msg .= '<div class="detail">';
176  $cpt = 0;
177  $ok = 0;
178  $ko = 0;
179 
180  foreach ($mesCasesCochees as $maLigneCochee) {
181  $maLigneCourante = explode("_", $maLigneCochee);
182  $monId = $maLigneCourante[0];
183  $monCompte = GETPOST('codeventil'.$monId);
184 
185  if ($monCompte <= 0) {
186  $msg .= '<div><span class="error">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</span></div>';
187  $ko++;
188  } else {
189  $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
190  $sql .= " SET fk_code_ventilation = ".((int) $monCompte);
191  $sql .= " WHERE rowid = ".((int) $monId);
192 
193  $accountventilated = new AccountingAccount($db);
194  $accountventilated->fetch($monCompte, '', 1);
195 
196  dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
197  if ($db->query($sql)) {
198  $msg .= '<div><span class="green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
199  $ok++;
200  } else {
201  $msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
202  $ko++;
203  }
204  }
205 
206  $cpt++;
207  }
208  $msg .= '</div>';
209  $msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
210  }
211 }
212 
213 
214 
215 /*
216  * View
217  */
218 
219 $form = new Form($db);
220 $formother = new FormOther($db);
221 
222 llxHeader('', $langs->trans("SuppliersVentilation"));
223 
224 if (empty($chartaccountcode)) {
225  print $langs->trans("ErrorChartOfAccountSystemNotSelected");
226  // End of page
227  llxFooter();
228  $db->close();
229  exit;
230 }
231 
232 // Supplier Invoice Lines
233 $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,";
234 $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,";
235 $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,";
236 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
237  $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,";
238  $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,";
239 } else {
240  $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,";
241  $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,";
242 }
243 $sql .= " p.tosell as status, p.tobuy as status_buy,";
244 $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
245 $sql .= " co.code as country_code, co.label as country_label,";
246 $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,";
247 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
248  $sql .= " spe.accountancy_code_customer as code_compta_client,";
249  $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
250  $sql .= " spe.accountancy_code_buy as company_code_buy";
251 } else {
252  $sql .= " s.code_compta as code_compta_client,";
253  $sql .= " s.code_compta_fournisseur,";
254  $sql .= " s.accountancy_code_buy as company_code_buy";
255 }
256 $parameters = array();
257 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
258 $sql .= $hookmanager->resPrint;
259 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
260 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
261 if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
262  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
263 }
264 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
265 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
266 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
267 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
268  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
269 }
270 $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
271 $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
272 $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;
273 $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;
274 $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;
275 $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;
276 $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
277 $sql .= " AND l.product_type <= 2";
278 // Define begin binding date
279 if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
280  $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
281 }
282 // Add search filter like
283 if ($search_societe) {
284  $sql .= natural_search('s.nom', $search_societe);
285 }
286 if ($search_lineid) {
287  $sql .= natural_search("l.rowid", $search_lineid, 1);
288 }
289 if (strlen(trim($search_invoice))) {
290  $sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
291 }
292 if (strlen(trim($search_ref))) {
293  $sql .= natural_search("p.ref", $search_ref);
294 }
295 /*if (strlen(trim($search_ref_supplier))) {
296  $sql .= natural_search("f.ref_supplier", $search_ref_supplier);
297 }*/
298 if (strlen(trim($search_label))) {
299  $sql .= natural_search(array("p.label", "f.libelle"), $search_label);
300 }
301 if (strlen(trim($search_desc))) {
302  $sql .= natural_search("l.description", $search_desc);
303 }
304 if (strlen(trim($search_amount))) {
305  $sql .= natural_search("l.total_ht", $search_amount, 1);
306 }
307 if (strlen(trim($search_account))) {
308  $sql .= natural_search("aa.account_number", $search_account);
309 }
310 if (strlen(trim($search_vat))) {
311  $sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
312 }
313 if ($search_date_start) {
314  $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
315 }
316 if ($search_date_end) {
317  $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
318 }
319 if (strlen(trim($search_country))) {
320  $arrayofcode = getCountriesInEEC();
321  $country_code_in_EEC = $country_code_in_EEC_without_me = '';
322  foreach ($arrayofcode as $key => $value) {
323  $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'";
324  if ($value != $mysoc->country_code) {
325  $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
326  }
327  }
328  if ($search_country == 'special_allnotme') {
329  $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
330  } elseif ($search_country == 'special_eec') {
331  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC, 1).")";
332  } elseif ($search_country == 'special_eecnotme') {
333  $sql .= " AND co.code IN (".$db->sanitize($country_code_in_EEC_without_me, 1).")";
334  } elseif ($search_country == 'special_noteec') {
335  $sql .= " AND co.code NOT IN (".$db->sanitize($country_code_in_EEC, 1).")";
336  } else {
337  $sql .= natural_search("co.code", $search_country);
338  }
339 }
340 if (strlen(trim($search_tvaintra))) {
341  $sql .= natural_search("s.tva_intra", $search_tvaintra);
342 }
343 if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
344  $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")";
345 } else {
347 }
348 $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
349 
350 // Add where from hooks
351 $parameters = array();
352 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
353 $sql .= $hookmanager->resPrint;
354 
355 $sql .= $db->order($sortfield, $sortorder);
356 
357 // Count total nb of records
358 $nbtotalofrecords = '';
359 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
360  $result = $db->query($sql);
361  $nbtotalofrecords = $db->num_rows($result);
362  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
363  $page = 0;
364  $offset = 0;
365  }
366 }
367 
368 $sql .= $db->plimit($limit + 1, $offset);
369 
370 dol_syslog('accountancy/supplier/list.php', LOG_DEBUG);
371 // MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso)
372 // 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
373 if ($db->type == 'mysqli') {
374  $db->query("SET SQL_BIG_SELECTS=1");
375 }
376 
377 $result = $db->query($sql);
378 if ($result) {
379  $num_lines = $db->num_rows($result);
380  $i = 0;
381 
382  $arrayofselected = is_array($toselect) ? $toselect : array();
383 
384  $param = '';
385  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
386  $param .= '&contextpage='.urlencode($contextpage);
387  }
388  if ($limit > 0 && $limit != $conf->liste_limit) {
389  $param .= '&limit='.urlencode($limit);
390  }
391  if ($search_societe) {
392  $param .= '&search_societe='.urlencode($search_societe);
393  }
394  if ($search_lineid) {
395  $param .= '&search_lineid='.urlencode($search_lineid);
396  }
397  if ($search_date_startday) {
398  $param .= '&search_date_startday='.urlencode($search_date_startday);
399  }
400  if ($search_date_startmonth) {
401  $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
402  }
403  if ($search_date_startyear) {
404  $param .= '&search_date_startyear='.urlencode($search_date_startyear);
405  }
406  if ($search_date_endday) {
407  $param .= '&search_date_endday='.urlencode($search_date_endday);
408  }
409  if ($search_date_endmonth) {
410  $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
411  }
412  if ($search_date_endyear) {
413  $param .= '&search_date_endyear='.urlencode($search_date_endyear);
414  }
415  if ($search_invoice) {
416  $param .= '&search_invoice='.urlencode($search_invoice);
417  }
418  if ($search_ref) {
419  $param .= '&search_ref='.urlencode($search_ref);
420  }
421  if ($search_ref_supplier) {
422  $param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
423  }
424  if ($search_label) {
425  $param .= '&search_label='.urlencode($search_label);
426  }
427  if ($search_desc) {
428  $param .= '&search_desc='.urlencode($search_desc);
429  }
430  if ($search_amount) {
431  $param .= '&search_amount='.urlencode($search_amount);
432  }
433  if ($search_vat) {
434  $param .= '&search_vat='.urlencode($search_vat);
435  }
436  if ($search_country) {
437  $param .= "&search_country=".urlencode($search_country);
438  }
439  if ($search_tvaintra) {
440  $param .= "&search_tvaintra=".urlencode($search_tvaintra);
441  }
442 
443  $arrayofmassactions = array(
444  'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
445  ,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
446  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
447  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
448  );
449  //if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
450  //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
451  if ($massaction !== 'set_default_account') {
452  $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
453  }
454 
455  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
456  print '<input type="hidden" name="action" value="ventil">';
457  if ($optioncss != '') {
458  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
459  }
460  print '<input type="hidden" name="token" value="'.newToken().'">';
461  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
462  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
463  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
464  print '<input type="hidden" name="page" value="'.$page.'">';
465 
466  print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
467 
468  if ($massaction == 'set_default_account') {
469  $formquestion[]=array('type' => 'other',
470  'name' => 'set_default_account',
471  'label' => $langs->trans("AccountancyCode"),
472  'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
473  print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
474  }
475 
476  print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
477 
478  if (!empty($msg)) {
479  print $msg.'<br>';
480  }
481 
482  $moreforfilter = '';
483 
484  print '<div class="div-table-responsive">';
485  print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
486 
487  // We add search filter
488  print '<tr class="liste_titre_filter">';
489  print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
490  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
491  //print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
492  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
493  print '<td class="liste_titre center">';
494  print '<div class="nowrap">';
495  print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
496  print '</div>';
497  print '<div class="nowrap">';
498  print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
499  print '</div>';
500  print '</td>';
501  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
502  print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
503  print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
504  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>';
505  print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
506  print '<td class="liste_titre">';
507  print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
508  //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
509  print '</td>';
510  print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
511  print '<td class="liste_titre"></td>';
512  print '<td class="liste_titre"></td>';
513  print '<td class="center liste_titre">';
514  $searchpicto = $form->showFilterButtons();
515  print $searchpicto;
516  print '</td>';
517  print "</tr>\n";
518 
519  print '<tr class="liste_titre">';
520  print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
521  print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
522  //print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
523  print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
524  print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
525  print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
526  //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
527  print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
528  print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
529  print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ', '', 1);
530  print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
531  print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
532  print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
533  print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall ');
534  print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
535  $checkpicto = '';
536  if ($massactionbutton) {
537  $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
538  }
539  print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
540  print "</tr>\n";
541 
542  $thirdpartystatic = new Societe($db);
543  $facturefourn_static = new FactureFournisseur($db);
544  $facturefourn_static_det = new SupplierInvoiceLine($db);
545  $product_static = new Product($db);
546 
547 
548  $accountingaccount_codetotid_cache = array();
549 
550  while ($i < min($num_lines, $limit)) {
551  $objp = $db->fetch_object($result);
552 
553  // product_type: 0 = service, 1 = product
554  // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
555  // issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
556  $code_buy_l = '';
557  $code_buy_p = '';
558  $code_buy_t = '';
559 
560  $thirdpartystatic->id = $objp->socid;
561  $thirdpartystatic->name = $objp->name;
562  $thirdpartystatic->client = $objp->client;
563  $thirdpartystatic->fournisseur = $objp->fournisseur;
564  $thirdpartystatic->code_client = $objp->code_client;
565  $thirdpartystatic->code_compta_client = $objp->code_compta_client;
566  $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
567  $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
568  $thirdpartystatic->email = $objp->email;
569  $thirdpartystatic->country_code = $objp->country_code;
570  $thirdpartystatic->tva_intra = $objp->tva_intra;
571  $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
572 
573  $product_static->ref = $objp->product_ref;
574  $product_static->id = $objp->product_id;
575  $product_static->type = $objp->type;
576  $product_static->label = $objp->product_label;
577  $product_static->status = $objp->status;
578  $product_static->status_buy = $objp->status_buy;
579  $product_static->accountancy_code_sell = $objp->code_sell;
580  $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
581  $product_static->accountancy_code_sell_export = $objp->code_sell_export;
582  $product_static->accountancy_code_buy = $objp->code_buy;
583  $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
584  $product_static->accountancy_code_buy_export = $objp->code_buy_export;
585  $product_static->tva_tx = $objp->tva_tx_prod;
586 
587  $facturefourn_static->ref = $objp->ref;
588  $facturefourn_static->id = $objp->facid;
589  $facturefourn_static->type = $objp->ftype;
590  $facturefourn_static->ref_supplier = $objp->ref_supplier;
591  $facturefourn_static->label = $objp->invoice_label;
592  $facturefourn_static->date = $db->jdate($objp->datef);
593  $facturefourn_static->fk_facture_source = $objp->fk_facture_source;
594 
595  $facturefourn_static_det->id = $objp->rowid;
596  $facturefourn_static_det->total_ht = $objp->total_ht;
597  $facturefourn_static_det->tva_tx = $objp->tva_tx_line;
598  $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
599  $facturefourn_static_det->product_type = $objp->type_l;
600  $facturefourn_static_det->desc = $objp->description;
601 
602  $accountingAccountArray = array(
603  'dom'=>$objp->aarowid,
604  'intra'=>$objp->aarowid_intra,
605  'export'=>$objp->aarowid_export,
606  'thirdparty' =>$objp->aarowid_thirdparty);
607 
608  $code_buy_p_notset = '';
609  $code_buy_t_notset = '';
610 
611  $suggestedid = 0;
612 
613  $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier');
614  if (!is_array($return) && $return<0) {
615  setEventMessage($accountingAccount->error, 'errors');
616  } else {
617  $suggestedid=$return['suggestedid'];
618  $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
619  $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
620  $code_buy_l=$return['code_l'];
621  $code_buy_p=$return['code_p'];
622  $code_buy_t=$return['code_t'];
623  }
624  //var_dump($return);
625 
626  if (!empty($code_buy_p)) {
627  // Value was defined previously
628  } else {
629  $code_buy_p_notset = 'color:orange';
630  }
631  if (empty($code_buy_l) && empty($code_buy_p)) {
632  $code_buy_p_notset = 'color:red';
633  }
634  /*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
635  $code_sell_p_notset = 'color:orange';
636  }*/
637 
638  // $code_buy_l is now default code of product/service
639  // $code_buy_p is now code of product/service
640  // $code_buy_t is now code of thirdparty
641  //var_dump($code_buy_l.' - '.$code_buy_p.' - '.$code_buy_t.' -> '.$suggestedid.' ('.$suggestedaccountingaccountbydefaultfor.' '.$suggestedaccountingaccountfor.')');
642 
643  print '<tr class="oddeven">';
644 
645  // Line id
646  print '<td>'.$facturefourn_static_det->id.'</td>';
647 
648  // Ref Invoice
649  print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
650  if ($objp->ref_supplier) {
651  print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
652  }
653  print '</td>';
654 
655  // Ref supplier invoice
656  /*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
657  print $objp->ref_supplier;
658  print '</td>';*/
659 
660  // Supplier invoice label
661  print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
662  print dol_escape_htmltag($objp->invoice_label);
663  print '</td>';
664 
665  // Date
666  print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
667 
668  // Ref Product
669  print '<td class="tdoverflowmax100">';
670  if ($product_static->id > 0) {
671  print $product_static->getNomUrl(1);
672  }
673  if ($product_static->label) {
674  print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
675  }
676  print '</td>';
677 
678  // Description of line
679  print '<td class="tdoverflowonsmartphone small">';
680  $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
681  $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
682  print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
683  print '</td>';
684 
685  print '<td class="right nowraponall amount">';
686  print price($objp->total_ht);
687  print '</td>';
688 
689  // Vat rate
690  $code_vat_differ = '';
691  //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
692  // $code_vat_differ = 'warning bold';
693  //}
694  print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
695  print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
696  print '</td>';
697 
698  // Thirdparty
699  print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'supplier').'</td>';
700 
701  // Country
702  $labelcountry = ($objp->country_code && ($langs->trans("Country".$objp->country_code) != "Country".$objp->country_code)) ? $langs->trans("Country".$objp->country_code) : $objp->country_label;
703  print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelcountry).'">';
704  print dol_escape_htmltag($labelcountry);
705  print '</td>';
706 
707  // VAT Num
708  print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
709 
710  // Found accounts
711  print '<td class="small">';
712  $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
713  $shelp = ''; $ttype = 'help';
714  if ($suggestedaccountingaccountbydefaultfor == 'eec') {
715  $shelp .= $langs->trans("SaleEEC");
716  } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') {
717  $shelp = $langs->trans("SaleEECWithVAT");
718  } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') {
719  $shelp = $langs->trans("SaleEECWithoutVATNumber");
720  $ttype = 'warning';
721  } elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
722  $shelp .= $langs->trans("SaleExport");
723  }
724  $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>');
725  print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
726  if ($product_static->id > 0) {
727  print '<br>';
728  $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
729  $shelp = ''; $ttype = 'help';
730  if ($suggestedaccountingaccountfor == 'eec') {
731  $shelp = $langs->trans("SaleEEC");
732  } elseif ($suggestedaccountingaccountfor == 'eecwithvat') {
733  $shelp = $langs->trans("SaleEECWithVAT");
734  } elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
735  $shelp = $langs->trans("SaleEECWithoutVATNumber");
736  $ttype = 'warning';
737  } elseif ($suggestedaccountingaccountfor == 'export') {
738  $shelp = $langs->trans("SaleExport");
739  }
740  $s .= (empty($code_buy_p) ? '<span style="'.$code_buy_p_notset.'">'.$langs->trans("NotDefined").'</span>' : length_accountg($code_buy_p));
741  print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
742  } else {
743  print '<br>';
744  $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
745  $shelp = '';
746  $s .= $langs->trans("NotDefined");
747  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
748  }
749  if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
750  print '<br>';
751  $s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
752  $shelp = '';
753  $s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
754  print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
755  }
756  print '</td>';
757 
758  // Suggested accounting account
759  print '<td>';
760  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');
761  print '</td>';
762 
763  // Column with checkbox
764  print '<td class="center">';
765  $ischecked = 0;
766  if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
767  $ischecked = 1;
768  }
769 
770  if (!empty($toselect)) {
771  $ischecked = 0;
772  if (in_array($objp->rowid."_".$i, $toselect)) {
773  $ischecked=1;
774  }
775  }
776 
777  print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
778  print '</td>';
779 
780  print '</tr>';
781  $i++;
782  }
783  if ($num_lines == 0) {
784  print '<tr><td colspan="14"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
785  }
786 
787  print '</table>';
788  print "</div>";
789 
790  print '</form>';
791 } else {
792  print $db->error();
793 }
794 if ($db->type == 'mysqli') {
795  $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
796 }
797 
798 // Add code to auto check the box when we select an account
799 print '<script type="text/javascript">
800 jQuery(document).ready(function() {
801  jQuery(".codeventil").change(function() {
802  var s=$(this).attr("id").replace("codeventil", "")
803  console.log(s+" "+$(this).val());
804  if ($(this).val() == -1) jQuery(".checkforselect"+s).prop("checked", false);
805  else jQuery(".checkforselect"+s).prop("checked", true);
806  });
807 });
808 </script>';
809 
810 // End of page
811 llxFooter();
812 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:50
dol_escape_htmltag
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.
Definition: functions.lib.php:1504
dol_trunc
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.
Definition: functions.lib.php:3950
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
FactureFournisseur\TYPE_CREDIT_NOTE
const TYPE_CREDIT_NOTE
Credit note invoice.
Definition: fournisseur.facture.class.php:336
$sql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
Definition: index.php:745
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:530
FactureFournisseur
Class to manage suppliers invoices.
Definition: fournisseur.facture.class.php:51
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
CommonInvoice\TYPE_SITUATION
const TYPE_SITUATION
Situation invoice.
Definition: commoninvoice.class.php:65
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
FormAccounting
Class to manage generation of HTML components for accounting management.
Definition: html.formaccounting.class.php:33
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5834
SupplierInvoiceLine
Class to manage line invoices.
Definition: fournisseur.facture.class.php:3324
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4025
getCountriesInEEC
getCountriesInEEC()
Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this...
Definition: company.lib.php:744
llxHeader
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
dol_getIdFromCode
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
Definition: functions.lib.php:8911
length_accountg
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
Definition: accounting.lib.php:94
dol_string_nohtmltag
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
Definition: functions.lib.php:6921
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1639
setEventMessage
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
Definition: functions.lib.php:8480
print_barre_liste
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.
Definition: functions.lib.php:5416
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
AccountingAccount
Class to manage accounting accounts.
Definition: accountingaccount.class.php:36
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:431
FactureFournisseur\TYPE_DEPOSIT
const TYPE_DEPOSIT
Deposit invoice.
Definition: fournisseur.facture.class.php:341
print_liste_field_titre
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Definition: functions.lib.php:5181
natural_search
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...
Definition: functions.lib.php:9823
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
price
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.
Definition: functions.lib.php:5708
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
dolGetFirstLineOfText
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
Definition: functions.lib.php:7145
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1106
dol_mktime
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...
Definition: functions.lib.php:2859
$nbtotalofrecords
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
vatrate
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.
Definition: functions.lib.php:5659
if
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
Definition: journals_list.php:25
FactureFournisseur\TYPE_REPLACEMENT
const TYPE_REPLACEMENT
Replacement invoice.
Definition: fournisseur.facture.class.php:331