dolibarr 22.0.5
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-2025 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
30
31
35class FormAccounting extends Form
36{
40 private $options_cache = array();
41
45 public $db;
46
50 public $error = '';
51
55 public $nbaccounts;
59 public $nbaccounts_category;
60
61
67 public function __construct($db)
68 {
69 $this->db = $db;
70 }
71
72 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
87 public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0)
88 {
89 // phpcs:enable
90 global $conf, $langs;
91
92 $out = '';
93
94 $options = array();
95 if ($usecache && !empty($this->options_cache[$usecache])) {
96 $options = $this->options_cache[$usecache];
97 $selected = $selectid;
98 } else {
99 $sql = "SELECT rowid, code, label, nature, entity, active";
100 $sql .= " FROM ".$this->db->prefix()."accounting_journal";
101 $sql .= " WHERE active = 1";
102 $sql .= " AND entity = ".((int) $conf->entity);
103 if ($nature && is_numeric($nature)) {
104 $sql .= " AND nature = ".((int) $nature);
105 }
106 $sql .= " ORDER BY code";
107
108 dol_syslog(get_class($this)."::select_journal", LOG_DEBUG);
109 $resql = $this->db->query($sql);
110
111 if (!$resql) {
112 $this->error = "Error ".$this->db->lasterror();
113 dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR);
114 return -1;
115 }
116
117 $selected = 0;
118 $langs->load('accountancy');
119 while ($obj = $this->db->fetch_object($resql)) {
120 $label = $obj->code.' - '.$langs->trans($obj->label);
121
122 $select_value_in = $obj->rowid;
123 $select_value_out = $obj->rowid;
124
125 // Try to guess if we have found default value
126 if ($select_in == 1) {
127 $select_value_in = $obj->code;
128 }
129 if ($select_out == 1) {
130 $select_value_out = $obj->code;
131 }
132 // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
133 if ($selectid != '' && $selectid == $select_value_in) {
134 //var_dump("Found ".$selectid." ".$select_value_in);
135 $selected = $select_value_out;
136 }
137
138 $options[$select_value_out] = $label;
139 }
140 $this->db->free($resql);
141
142 if ($usecache) {
143 $this->options_cache[$usecache] = $options;
144 }
145 }
146
147 $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, ($disabledajaxcombo ? 0 : 1));
148
149 return $out;
150 }
151
152 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
167 public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0)
168 {
169 // phpcs:enable
170 global $conf, $langs;
171
172 $out = '';
173
174 $options = array();
175 if ($usecache && !empty($this->options_cache[$usecache])) {
176 $options = $this->options_cache[$usecache];
177 $selected = $selectedIds;
178 } else {
179 $sql = "SELECT rowid, code, label, nature, entity, active";
180 $sql .= " FROM ".$this->db->prefix()."accounting_journal";
181 $sql .= " WHERE active = 1";
182 $sql .= " AND entity = ".$conf->entity;
183 if ($nature && is_numeric($nature)) {
184 $sql .= " AND nature = ".((int) $nature);
185 }
186 $sql .= " ORDER BY code";
187
188 dol_syslog(get_class($this)."::multi_select_journal", LOG_DEBUG);
189 $resql = $this->db->query($sql);
190
191 if (!$resql) {
192 $this->error = "Error ".$this->db->lasterror();
193 dol_syslog(get_class($this)."::multi_select_journal ".$this->error, LOG_ERR);
194 return -1;
195 }
196
197 $selected = array();
198 $langs->load('accountancy');
199 while ($obj = $this->db->fetch_object($resql)) {
200 $label = $langs->trans($obj->label);
201
202 $select_value_in = $obj->rowid;
203 $select_value_out = $obj->rowid;
204
205 // Try to guess if we have found default value
206 if ($select_in == 1) {
207 $select_value_in = $obj->code;
208 }
209 if ($select_out == 1) {
210 $select_value_out = $obj->code;
211 }
212 // Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
213 if (!empty($selectedIds) && in_array($select_value_in, $selectedIds)) {
214 //var_dump("Found ".$selectid." ".$select_value_in);
215 $selected[] = $select_value_out;
216 }
217 $options[$select_value_out] = $label;
218 }
219 $this->db->free($resql);
220
221 if ($usecache) {
222 $this->options_cache[$usecache] = $options;
223 }
224 }
225
226 $out .= Form::multiselectarray($htmlname, $options, $selected, $showempty, 0, $morecss, 0, 0, '', 'code_journal', '', ($disabledajaxcombo ? 0 : 1));
227
228 return $out;
229 }
230
231 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
244 public function select_accounting_category($selected = 0, $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0)
245 {
246 // phpcs:enable
247 global $langs, $mysoc;
248
249 if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) {
250 dol_print_error(null, 'Call to select_accounting_account with mysoc country not yet defined');
251 exit;
252 }
253
254 $out = '';
255
256 if (!empty($mysoc->country_id)) {
257 $sql = "SELECT c.rowid, c.label as type, c.range_account";
258 $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c";
259 $sql .= " WHERE c.active = 1";
260 $sql .= " AND c.category_type = 0";
261 if (empty($allcountries)) {
262 $sql .= " AND c.fk_country = ".((int) $mysoc->country_id);
263 }
264 $sql .= " ORDER BY c.label ASC";
265 } else {
266 $sql = "SELECT c.rowid, c.label as type, c.range_account";
267 $sql .= " FROM ".$this->db->prefix()."c_accounting_category as c, ".$this->db->prefix()."c_country as co";
268 $sql .= " WHERE c.active = 1";
269 $sql .= " AND c.category_type = 0";
270 $sql .= " AND c.fk_country = co.rowid";
271 if (empty($allcountries)) {
272 $sql .= " AND co.code = '".$this->db->escape($mysoc->country_code)."'";
273 }
274 $sql .= " ORDER BY c.label ASC";
275 }
276
277 $this->nbaccounts_category = 0;
278
279 dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
280 $resql = $this->db->query($sql);
281 if ($resql) {
282 $num = $this->db->num_rows($resql);
283 if ($num) {
284 $this->nbaccounts_category = $num;
285
286 $out .= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'">';
287 $i = 0;
288
289 if ($useempty) {
290 $out .= '<option value="0">&nbsp;</option>';
291 }
292 while ($i < $num) {
293 $obj = $this->db->fetch_object($resql);
294
295 $titletoshowhtml = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' <span class="opacitymedium">('.$obj->range_account.')</span>' : '');
296 $titletoshow = ($maxlen ? dol_trunc($obj->type, $maxlen) : $obj->type).($obj->range_account ? ' ('.$obj->range_account.')' : '');
297
298 $out .= '<option value="'.$obj->rowid.'"';
299 if ($obj->rowid == $selected) {
300 $out .= ' selected';
301 }
302 //$out .= ' data-html="'.dol_escape_htmltag(dol_string_onlythesehtmltags($titletoshowhtml, 1, 0, 0, 0, array('span'))).'"';
303 $out .= ' data-html="'.dolPrintHTMLForAttribute($titletoshowhtml).'"';
304 $out .= '>';
305 $out .= dol_escape_htmltag($titletoshow);
306 $out .= '</option>';
307 $i++;
308 }
309 $out .= '</select>';
310 //if ($user->admin && $help) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
311
312 $out .= ajax_combobox($htmlname, array());
313 } else {
314 $out .= '<span class="opacitymedium">'.$langs->trans("ErrorNoAccountingCategoryForThisCountry", $mysoc->country_code, $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("AccountingCategories")).'</span>';
315 }
316 } else {
317 dol_print_error($this->db);
318 }
319
320 return $out;
321 }
322
323 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
331 public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
332 {
333 // phpcs:enable
334 $options = array();
335
336 $sql = "SELECT DISTINCT import_key FROM ".$this->db->prefix()."accounting_bookkeeping";
337 $sql .= " WHERE entity IN (".getEntity('accountancy').")";
338 $sql .= ' ORDER BY import_key DESC';
339
340 dol_syslog(get_class($this)."::select_bookkeeping_importkey", LOG_DEBUG);
341 $resql = $this->db->query($sql);
342
343 if (!$resql) {
344 $this->error = "Error ".$this->db->lasterror();
345 dol_syslog(get_class($this)."::select_bookkeeping_importkey ".$this->error, LOG_ERR);
346 return -1;
347 }
348
349 while ($obj = $this->db->fetch_object($resql)) {
350 $options[$obj->import_key] = $obj->import_key;
351 }
352
353 return Form::selectarray($htmlname, $options, $selectedkey);
354 }
355
356 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
372 public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $active = '1', $centralized = 0)
373 {
374 global $conf, $langs;
375 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
376
377 $out = '';
378 $selected = '';
379 $options = [];
380
381 if ($showempty == 2) {
382 $options['0'] = '--- '.$langs->trans("None").' ---';
383 }
384
385 if ($usecache && !empty($this->options_cache[$usecache])) {
386 $options += $this->options_cache[$usecache];
387 $selected = $selectid;
388 } else {
389 $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', 50);
390
391 // Construct SQL request
392 $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version, aa.centralized";
393 $sql .= " FROM ".$this->db->prefix()."accounting_account as aa";
394 $sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
395 $sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
396
397 if ($active === '1') {
398 $sql .= " AND aa.active = 1";
399 } elseif ($active === '0') {
400 $sql .= " AND aa.active = 0";
401 }
402
403 if ($centralized == 1) {
404 $sql .= " AND aa.centralized = 1";
405 }
406
407 $sql .= " AND aa.entity=".((int) $conf->entity);
408
409 // Sorting: centralized accounts first, then others
410 if ($centralized == 2) {
411 $sql .= " ORDER BY aa.centralized DESC, aa.account_number";
412 } else {
413 $sql .= " ORDER BY aa.account_number";
414 }
415
416 dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
417 $resql = $this->db->query($sql);
418
419 if (!$resql) {
420 $this->error = "Error ".$this->db->lasterror();
421 dol_syslog(get_class($this)."::select_account ".$this->error, LOG_ERR);
422 return -1;
423 }
424
425 $num_rows = $this->db->num_rows($resql);
426
427 if ($num_rows == 0 && getDolGlobalInt('CHARTOFACCOUNTS') <= 0) {
428 $langs->load("errors");
429 $showempty = $langs->trans("ErrorYouMustFirstSetupYourChartOfAccount");
430 } else {
431 $selected = $selectid;
432 $lastCentralized = null;
433
434 while ($obj = $this->db->fetch_object($resql)) {
435 // Insert a separator if you change category (centralized = 1 → 0)
436 if ($centralized == 2 && $lastCentralized !== null && $lastCentralized != $obj->centralized) {
437 $options['0'] = '-------------'; // Visual separator
438 }
439
440 $lastCentralized = $obj->centralized;
441
442 $labeltoshow = !empty($obj->labelshort) ? $obj->labelshort : $obj->label;
443 $label = length_accountg($obj->account_number).' - '.$labeltoshow;
444 $label = dol_trunc($label, $trunclength);
445
446 $select_value_in = $obj->rowid;
447 $select_value_out = $obj->rowid;
448
449 if ($select_in == 1) {
450 $select_value_in = $obj->account_number;
451 }
452 if ($select_out == 1) {
453 $select_value_out = $obj->account_number;
454 }
455
456 if ($selectid != '' && $selectid == $select_value_in) {
457 $selected = $select_value_out;
458 }
459
460 $options[$select_value_out] = $label;
461 }
462 }
463
464 $this->db->free($resql);
465
466 if ($usecache) {
467 $this->options_cache[$usecache] = $options;
468 unset($this->options_cache[$usecache]['0']);
469 }
470 }
471
472 $out .= Form::selectarray($htmlname, $options, $selected, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
473 $this->nbaccounts = count($options) - ($showempty == 2 ? 1 : 0);
474
475 return $out;
476 }
477
478 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
490 public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '')
491 {
492 // phpcs:enable
493 global $conf;
494
495 $aux_account = array();
496
497 if ($usecache && !empty($this->options_cache[$usecache])) {
498 $aux_account += $this->options_cache[$usecache]; // We use + instead of array_merge because we don't want to reindex key from 0
499 } else {
500 dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
501
502 // Auxiliary thirdparties account
503 $sql = "SELECT code_compta as code_compta_client, code_compta_fournisseur, nom as name";
504 $sql .= " FROM ".$this->db->prefix()."societe";
505 $sql .= " WHERE entity IN (".getEntity('societe').")";
506 $sql .= " AND (client IN (1,3) OR fournisseur = 1)";
507
508 $resql = $this->db->query($sql);
509 if ($resql) {
510 while ($obj = $this->db->fetch_object($resql)) {
511 if (!empty($obj->code_compta_client)) {
512 $aux_account[$obj->code_compta_client] = $obj->code_compta_client.' <span class="opacitymedium">('.$obj->name.')</span>';
513 }
514 if (!empty($obj->code_compta_fournisseur)) {
515 $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' <span class="opacitymedium">('.$obj->name.')</span>';
516 }
517 }
518 } else {
519 $this->error = "Error ".$this->db->lasterror();
520 dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
521 return -1;
522 }
523
524 $this->db->free($resql);
525
526 // Auxiliary user account
527 $sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
528 $sql .= " FROM ".$this->db->prefix()."user";
529 $sql .= " WHERE entity IN (".getEntity('user').")";
530 $sql .= " ORDER BY accountancy_code";
531
532 $resql = $this->db->query($sql);
533 if ($resql) {
534 while ($obj = $this->db->fetch_object($resql)) {
535 if (!empty($obj->accountancy_code)) {
536 $aux_account[$obj->accountancy_code] = $obj->accountancy_code.' <span class="opacitymedium">('.dolGetFirstLastname($obj->firstname, $obj->lastname).')</span>';
537 }
538 }
539 } else {
540 $this->error = "Error ".$this->db->lasterror();
541 dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
542 return -1;
543 }
544 $this->db->free($resql);
545
546 ksort($aux_account);
547
548 if ($usecache) {
549 $this->options_cache[$usecache] = $aux_account;
550 }
551 }
552
553 // Build select
554 $out = '';
555 $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty) : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
556 //automatic filling if we give the name of the subledger_label input
557 if (!empty($conf->use_javascript_ajax) && !empty($labelhtmlname)) {
558 $out .= '<script nonce="'.getNonce().'">
559 jQuery(document).ready(() => {
560 $("#'.$htmlname.'").on("select2:select", function(e) {
561 var regExp = /\‍(([^)]+)\‍)/;
562 const match = regExp.exec(e.params.data.text);
563 $(\'input[name="'.dol_escape_js($labelhtmlname).'"]\').val(match[1]);
564 });
565 });
566
567 </script>';
568 }
569
570 return $out;
571 }
572
573 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
583 public function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
584 {
585 // phpcs:enable
586 global $conf;
587
588 $out_array = array();
589
590 $sql = "SELECT DISTINCT date_format(doc_date, '%Y') as dtyear";
591 $sql .= " FROM ".$this->db->prefix()."accounting_bookkeeping";
592 $sql .= " WHERE entity IN (".getEntity('accountancy').")";
593 $sql .= " ORDER BY date_format(doc_date, '%Y')";
594 dol_syslog(__METHOD__, LOG_DEBUG);
595 $resql = $this->db->query($sql);
596
597 if (!$resql) {
598 $this->error = "Error ".$this->db->lasterror();
599 dol_syslog(__METHOD__.$this->error, LOG_ERR);
600 return -1;
601 }
602 while ($obj = $this->db->fetch_object($resql)) {
603 $out_array[$obj->dtyear] = $obj->dtyear;
604 }
605 $this->db->free($resql);
606
607 if ($output_format == 'html') {
608 return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
609 } else {
610 return $out_array;
611 }
612 }
613
626 public function formAccountingAccount($page, $selected = '', $htmlname = 'none', $option = 0, $useempty = 1, $filter = '', $nooutput = 0)
627 {
628 global $langs;
629
630 $out = '';
631 if ($htmlname != "none") {
632 $out .= '<form method="post" action="' . $page . '">';
633 $out .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
634 $out .= '<input type="hidden" name="token" value="' . newToken() . '">';
635 if ($option == 0) {
636 $out .= $this->select_account($selected, $htmlname, $useempty, array(), 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts', $filter);
637 } else {
638 $out .= $this->select_auxaccount($selected, $htmlname, $useempty, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'subaccounts');
639 }
640 $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" name="modify" value="' . $langs->trans("Modify") . '">';
641 //$out .= '<input type="submit" class="button smallpaddingimp valignmiddle button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
642 $out .= '</form>';
643 } else {
644 $out .= "&nbsp;";
645 }
646
647 if ($nooutput) {
648 return $out;
649 } else {
650 print $out;
651 }
652 }
653
666 public static function printJournalLine($langs, $date, $ref, $accountAccounting, $labelOperation, $paymentMode, $amount)
667 {
668 $out = '<tr class="oddeven">';
669 $out .= '<td>'.$date.'</td>';
670 $out .= '<td>'.$ref.'</td>';
671 // Ledger account
672 $out .= '<td>';
673 $accounttoshow = length_accountg($accountAccounting);
674 if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
675 // Could be ProductAccountNotDefined, VATAccountNotDefined, ...
676 $out .= '<span class="error">'.$langs->trans('AccountNotDefined').'</span>';
677 } else {
678 $out .= $accounttoshow;
679 }
680 $out .= '</td>';
681 $out .= '<td>'.$labelOperation.'</td>';
682 $out .= '<td class="center">'.$paymentMode.'</td>';
683 $out .= '<td class="nowraponall right amount">'.($amount >= 0 ? price($amount) : '').'</td>';
684 $out .= '<td class="nowraponall right amount">'.($amount < 0 ? price(-$amount) : '').'</td>';
685 $out .= '</tr>';
686
687 print $out;
688 }
689}
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:475
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_account($selectid, $htmlname='account', $showempty=0, $event=array(), $select_in=0, $select_out=0, $morecss='minwidth100 maxwidth300 maxwidthonsmartphone', $usecache='', $active='1', $centralized=0)
Return list of accounts with label by chart of accounts.
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.
static printJournalLine($langs, $date, $ref, $accountAccounting, $labelOperation, $paymentMode, $amount)
Print line into the journal table.
Class to manage generation of HTML components Only common components must be here.
static multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $nu='', $placeholder='', $addjscombo=-1)
Show a multiselect form from an array.
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.
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_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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79