dolibarr 20.0.0
html.formaccounting.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
3 * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
4 * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
5 * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
6 * Copyright (C) 2016-2024 Alexandre Spangaro <aspangaro@easya.solutions>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
29
30
34class FormAccounting extends Form
35{
39 private $options_cache = array();
40
44 public $db;
45
49 public $error = '';
50
54 public $nbaccounts;
58 public $nbaccounts_category;
59
60
66 public function __construct($db)
67 {
68 $this->db = $db;
69 }
70
71 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
86 public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0)
87 {
88 // phpcs:enable
89 global $conf, $langs;
90
91 $out = '';
92
93 $options = array();
94 if ($usecache && !empty($this->options_cache[$usecache])) {
95 $options = $this->options_cache[$usecache];
96 $selected = $selectid;
97 } else {
98 $sql = "SELECT rowid, code, label, nature, entity, active";
99 $sql .= " FROM ".$this->db->prefix()."accounting_journal";
100 $sql .= " WHERE active = 1";
101 $sql .= " AND entity = ".((int) $conf->entity);
102 if ($nature && is_numeric($nature)) {
103 $sql .= " AND nature = ".((int) $nature);
104 }
105 $sql .= " ORDER BY code";
106
107 dol_syslog(get_class($this)."::select_journal", LOG_DEBUG);
108 $resql = $this->db->query($sql);
109
110 if (!$resql) {
111 $this->error = "Error ".$this->db->lasterror();
112 dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR);
113 return -1;
114 }
115
116 $selected = 0;
117 $langs->load('accountancy');
118 while ($obj = $this->db->fetch_object($resql)) {
119 $label = $obj->code.' - '.$langs->trans($obj->label);
120
121 $select_value_in = $obj->rowid;
122 $select_value_out = $obj->rowid;
123
124 // Try to guess if we have found default value
125 if ($select_in == 1) {
126 $select_value_in = $obj->code;
127 }
128 if ($select_out == 1) {
129 $select_value_out = $obj->code;
130 }
131 // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
132 if ($selectid != '' && $selectid == $select_value_in) {
133 //var_dump("Found ".$selectid." ".$select_value_in);
134 $selected = $select_value_out;
135 }
136
137 $options[$select_value_out] = $label;
138 }
139 $this->db->free($resql);
140
141 if ($usecache) {
142 $this->options_cache[$usecache] = $options;
143 }
144 }
145
146 $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo ? 0 : 1));
147
148 return $out;
149 }
150
151 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
166 public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0)
167 {
168 // phpcs:enable
169 global $conf, $langs;
170
171 $out = '';
172
173 $options = array();
174 if ($usecache && !empty($this->options_cache[$usecache])) {
175 $options = $this->options_cache[$usecache];
176 $selected = $selectedIds;
177 } else {
178 $sql = "SELECT rowid, code, label, nature, entity, active";
179 $sql .= " FROM ".$this->db->prefix()."accounting_journal";
180 $sql .= " WHERE active = 1";
181 $sql .= " AND entity = ".$conf->entity;
182 if ($nature && is_numeric($nature)) {
183 $sql .= " AND nature = ".((int) $nature);
184 }
185 $sql .= " ORDER BY code";
186
187 dol_syslog(get_class($this)."::multi_select_journal", LOG_DEBUG);
188 $resql = $this->db->query($sql);
189
190 if (!$resql) {
191 $this->error = "Error ".$this->db->lasterror();
192 dol_syslog(get_class($this)."::multi_select_journal ".$this->error, LOG_ERR);
193 return -1;
194 }
195
196 $selected = array();
197 $langs->load('accountancy');
198 while ($obj = $this->db->fetch_object($resql)) {
199 $label = $langs->trans($obj->label);
200
201 $select_value_in = $obj->rowid;
202 $select_value_out = $obj->rowid;
203
204 // Try to guess if we have found default value
205 if ($select_in == 1) {
206 $select_value_in = $obj->code;
207 }
208 if ($select_out == 1) {
209 $select_value_out = $obj->code;
210 }
211 // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
212 if (!empty($selectedIds) && in_array($select_value_in, $selectedIds)) {
213 //var_dump("Found ".$selectid." ".$select_value_in);
214 $selected[] = $select_value_out;
215 }
216 $options[$select_value_out] = $label;
217 }
218 $this->db->free($resql);
219
220 if ($usecache) {
221 $this->options_cache[$usecache] = $options;
222 }
223 }
224
225 $out .= Form::multiselectarray($htmlname, $options, $selected, $showempty, 0, $morecss, 0, 0, 0, 'code_journal', '', ($disabledajaxcombo ? 0 : 1));
226
227 return $out;
228 }
229
230 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
243 public function select_accounting_category($selected = 0, $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0)
244 {
245 // phpcs:enable
246 global $langs, $mysoc;
247
248 if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) {
249 dol_print_error(null, 'Call to select_accounting_account with mysoc country not yet defined');
250 exit;
251 }
252
253 $out = '';
254
255 if (!empty($mysoc->country_id)) {
256 $sql = "SELECT c.rowid, c.label as type, c.range_account";
257 $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c";
258 $sql .= " WHERE c.active = 1";
259 $sql .= " AND c.category_type = 0";
260 if (empty($allcountries)) {
261 $sql .= " AND c.fk_country = ".((int) $mysoc->country_id);
262 }
263 $sql .= " ORDER BY c.label ASC";
264 } else {
265 $sql = "SELECT c.rowid, c.label as type, c.range_account";
266 $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c, ".$this->db->prefix()."c_country as co";
267 $sql .= " WHERE c.active = 1";
268 $sql .= " AND c.category_type = 0";
269 $sql .= " AND c.fk_country = co.rowid";
270 if (empty($allcountries)) {
271 $sql .= " AND co.code = '".$this->db->escape($mysoc->country_code)."'";
272 }
273 $sql .= " ORDER BY c.label ASC";
274 }
275
276 $this->nbaccounts_category = 0;
277
278 dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
279 $resql = $this->db->query($sql);
280 if ($resql) {
281 $num = $this->db->num_rows($resql);
282 if ($num) {
283 $this->nbaccounts_category = $num;
284
285 $out .= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
286 $i = 0;
287
288 if ($useempty) {
289 $out .= '<option value="0">&nbsp;</option>';
290 }
291 while ($i < $num) {
292 $obj = $this->db->fetch_object($resql);
293
294 $titletoshowhtml = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' <span class="opacitymedium">('.$obj->range_account.')</span>' : '');
295 $titletoshow = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' ('.$obj->range_account.')' : '');
296
297 $out .= '<option value="'.$obj->rowid.'"';
298 if ($obj->rowid == $selected) {
299 $out .= ' selected';
300 }
301 //$out .= ' data-html="'.dol_escape_htmltag(dol_string_onlythesehtmltags($titletoshowhtml, 1, 0, 0, 0, array('span'))).'"';
302 $out .= ' data-html="'.dolPrintHTMLForAttribute($titletoshowhtml).'"';
303 $out .= '>';
304 $out .= dol_escape_htmltag($titletoshow);
305 $out .= '</option>';
306 $i++;
307 }
308 $out .= '</select>';
309 //if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
310
311 $out .= ajax_combobox($htmlname, array());
312 } else {
313 $out .= '<span class="opacitymedium">'.$langs->trans("ErrorNoAccountingCategoryForThisCountry", $mysoc->country_code, $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("AccountingCategories")).'</span>';
314 }
315 } else {
316 dol_print_error($this->db);
317 }
318
319 return $out;
320 }
321
322 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
330 public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
331 {
332 // phpcs:enable
333 $options = array();
334
335 $sql = "SELECT DISTINCT import_key FROM ".$this->db->prefix()."accounting_bookkeeping";
336 $sql .= " WHERE entity IN (".getEntity('accountancy').")";
337 $sql .= ' ORDER BY import_key DESC';
338
339 dol_syslog(get_class($this)."::select_bookkeeping_importkey", LOG_DEBUG);
340 $resql = $this->db->query($sql);
341
342 if (!$resql) {
343 $this->error = "Error ".$this->db->lasterror();
344 dol_syslog(get_class($this)."::select_bookkeeping_importkey ".$this->error, LOG_ERR);
345 return -1;
346 }
347
348 while ($obj = $this->db->fetch_object($resql)) {
349 $options[$obj->import_key] = $obj->import_key;
350 }
351
352 return Form::selectarray($htmlname, $options, $selectedkey);
353 }
354
355 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
370 public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $active = '1')
371 {
372 // phpcs:enable
373 global $conf, $langs;
374
375 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
376
377 $out = '';
378
379 $options = array();
380
381 if ($showempty == 2) {
382 $options['0'] = '--- '.$langs->trans("None").' ---';
383 }
384
385 if ($usecache && !empty($this->options_cache[$usecache])) {
386 $options = $options + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
387 $selected = $selectid;
388 } else {
389 $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', 50);
390
391 $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
392 $sql .= " FROM ".$this->db->prefix()."accounting_account as aa";
393 $sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
394 $sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
395 if ($active === '1') {
396 $sql .= " AND aa.active = 1";
397 } elseif ($active === '0') {
398 $sql .= " AND aa.active = 0";
399 }
400 $sql .= " AND aa.entity=".((int) $conf->entity);
401 $sql .= " ORDER BY aa.account_number";
402
403 dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
404 $resql = $this->db->query($sql);
405
406 if (!$resql) {
407 $this->error = "Error ".$this->db->lasterror();
408 dol_syslog(get_class($this)."::select_account ".$this->error, LOG_ERR);
409 return -1;
410 }
411
412 $num_rows = $this->db->num_rows($resql);
413
414 if ($num_rows == 0 && getDolGlobalInt('CHARTOFACCOUNTS') <= 0) {
415 $langs->load("errors");
416 $showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount");
417 } else {
418 $selected = $selectid; // selectid can be -1, 0, 123
419 while ($obj = $this->db->fetch_object($resql)) {
420 if (empty($obj->labelshort)) {
421 $labeltoshow = $obj->label;
422 } else {
423 $labeltoshow = $obj->labelshort;
424 }
425
426 $label = length_accountg($obj->account_number).' - '.$labeltoshow;
427 $label = dol_trunc($label, $trunclength);
428
429 $select_value_in = $obj->rowid;
430 $select_value_out = $obj->rowid;
431
432 // Try to guess if we have found default value
433 if ($select_in == 1) {
434 $select_value_in = $obj->account_number;
435 }
436 if ($select_out == 1) {
437 $select_value_out = $obj->account_number;
438 }
439 // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
440 // Because same account_number can be share between different accounting_system and do have the same meaning
441 if ($selectid != '' && $selectid == $select_value_in) {
442 //var_dump("Found ".$selectid." ".$select_value_in);
443 $selected = $select_value_out;
444 }
445
446 $options[$select_value_out] = $label;
447 }
448 }
449
450 $this->db->free($resql);
451
452 if ($usecache) {
453 $this->options_cache[$usecache] = $options;
454 unset($this->options_cache[$usecache]['0']);
455 }
456 }
457
458
459 $out .= Form::selectarray($htmlname, $options, $selected, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
460
461 $this->nbaccounts = count($options) - ($showempty == 2 ? 1 : 0);
462
463 return $out;
464 }
465
466 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
478 public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '')
479 {
480 // phpcs:enable
481 global $conf;
482
483 $aux_account = array();
484
485 if ($usecache && !empty($this->options_cache[$usecache])) {
486 $aux_account = $aux_account + $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
487 } else {
488 dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
489
490 // Auxiliary thirdparties account
491 $sql = "SELECT code_compta, code_compta_fournisseur, nom as name";
492 $sql .= " FROM ".$this->db->prefix()."societe";
493 $sql .= " WHERE entity IN (".getEntity('societe').")";
494 $sql .= " AND (client IN (1,3) OR fournisseur = 1)";
495
496 $resql = $this->db->query($sql);
497 if ($resql) {
498 while ($obj = $this->db->fetch_object($resql)) {
499 if (!empty($obj->code_compta)) {
500 $aux_account[$obj->code_compta] = $obj->code_compta.' <span class="opacitymedium">('.$obj->name.')</span>';
501 }
502 if (!empty($obj->code_compta_fournisseur)) {
503 $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' <span class="opacitymedium">('.$obj->name.')</span>';
504 }
505 }
506 } else {
507 $this->error = "Error ".$this->db->lasterror();
508 dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
509 return -1;
510 }
511
512 ksort($aux_account);
513
514 $this->db->free($resql);
515
516 // Auxiliary user account
517 $sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
518 $sql .= " FROM ".$this->db->prefix()."user";
519 $sql .= " WHERE entity IN (".getEntity('user').")";
520 $sql .= " ORDER BY accountancy_code";
521
522 $resql = $this->db->query($sql);
523 if ($resql) {
524 while ($obj = $this->db->fetch_object($resql)) {
525 if (!empty($obj->accountancy_code)) {
526 $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' <span class="opacitymedium">('.dolGetFirstLastname($obj->firstname, $obj->lastname).')</span>';
527 }
528 }
529 } else {
530 $this->error = "Error ".$this->db->lasterror();
531 dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
532 return -1;
533 }
534 $this->db->free($resql);
535
536 if ($usecache) {
537 $this->options_cache[$usecache] = $aux_account;
538 }
539 }
540
541 // Build select
542 $out = '';
543 $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
544 //automatic filling if we give the name of the subledger_label input
545 if (!empty($conf->use_javascript_ajax) && !empty($labelhtmlname)) {
546 $out .= '<script nonce="'.getNonce().'">
547 jQuery(document).ready(() => {
548 $("#'.$htmlname.'").on("select2:select", function(e) {
549 var regExp = /\‍(([^)]+)\‍)/;
550 const match = regExp.exec(e.params.data.text);
551 $(\'input[name="'.dol_escape_js($labelhtmlname).'"]\').val(match[1]);
552 });
553 });
554
555 </script>';
556 }
557
558 return $out;
559 }
560
561 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
571 public function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
572 {
573 // phpcs:enable
574 global $conf;
575
576 $out_array = array();
577
578 $sql = "SELECT DISTINCT date_format(doc_date, '%Y') as dtyear";
579 $sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
580 $sql .= " WHERE entity IN (".getEntity('accountancy').")";
581 $sql .= " ORDER BY date_format(doc_date, '%Y')";
582 dol_syslog(__METHOD__, LOG_DEBUG);
583 $resql = $this->db->query($sql);
584
585 if (!$resql) {
586 $this->error = "Error ".$this->db->lasterror();
587 dol_syslog(__METHOD__.$this->error, LOG_ERR);
588 return -1;
589 }
590 while ($obj = $this->db->fetch_object($resql)) {
591 $out_array[$obj->dtyear] = $obj->dtyear;
592 }
593 $this->db->free($resql);
594
595 if ($output_format == 'html') {
596 return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
597 } else {
598 return $out_array;
599 }
600 }
601
614 public function formAccountingAccount($page, $selected = '', $htmlname = 'none', $option = 0, $useempty = 1, $filter = '', $nooutput = 0)
615 {
616 global $langs;
617
618 $out = '';
619 if ($htmlname != "none") {
620 $out .= '<form method="post" action="' . $page . '">';
621 $out .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
622 $out .= '<input type="hidden" name="token" value="' . newToken() . '">';
623 if ($option == 0) {
624 $out .= $this->select_account($selected, $htmlname, $useempty, array(), 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts', $filter);
625 } else {
626 $out .= $this->select_auxaccount($selected, $htmlname, $useempty, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'subaccounts');
627 }
628 $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" name="modify" value="' . $langs->trans("Modify") . '">';
629 //$out .= '<input type="submit" class="button smallpaddingimp valignmiddle button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
630 $out .= '</form>';
631 } else {
632 $out .= "&nbsp;";
633 }
634
635 if ($nooutput) {
636 return $out;
637 } else {
638 print $out;
639 }
640 }
641}
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:456
Class to manage generation of HTML components for accounting management.
select_bookkeeping_importkey($htmlname='importkey', $selectedkey='')
Return select filter with date of transaction.
__construct($db)
Constructor.
select_journal($selectid, $htmlname='journal', $nature=0, $showempty=0, $select_in=0, $select_out=0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0)
Return list of journals with label by nature.
select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='minwidth100 maxwidth300 maxwidthonsmartphone', $usecache='', $labelhtmlname='')
Return list of auxiliary accounts.
selectyear_accountancy_bookkepping($selected='', $htmlname='yearid', $useempty=0, $output_format='html')
Return HTML combo list of years existing into book keepping.
formAccountingAccount($page, $selected='', $htmlname='none', $option=0, $useempty=1, $filter='', $nooutput=0)
Output html select to select accounting account.
multi_select_journal($selectedIds=array(), $htmlname='journal', $nature=0, $showempty=0, $select_in=0, $select_out=0, $morecss='', $usecache='', $disabledajaxcombo=0)
Return list of journals with label by nature.
select_accounting_category($selected=0, $htmlname='account_category', $useempty=0, $maxlen=0, $help=1, $allcountries=0)
Return list of accounting category.
select_account($selectid, $htmlname='account', $showempty=0, $event=array(), $select_in=0, $select_out=0, $morecss='minwidth100 maxwidth300 maxwidthonsmartphone', $usecache='', $active='1')
Return list of accounts with label by chart of accounts.
Class to manage generation of HTML components Only common components must be here.
static selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='minwidth75', $addjscombo=1, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
Return a HTML select string, built from an array of key+value.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...