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