dolibarr 20.0.2
limits.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2022 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
31
32// Load translation files required by the page
33$langs->loadLangs(array('companies', 'products', 'admin'));
34
35$action = GETPOST('action', 'aZ09');
36$cancel = GETPOST('cancel', 'aZ09');
37$currencycode = GETPOST('currencycode', 'alpha');
38
39if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
40 // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
41 $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
42}
43
44$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
45$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
46$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
47$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
48
49$valmainmaxdecimalsunit = GETPOSTINT($mainmaxdecimalsunit);
50$valmainmaxdecimalstot = GETPOSTINT($mainmaxdecimalstot);
51$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
52$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
53
54if (!$user->admin) {
56}
57
58
59/*
60 * Actions
61 */
62
63if ($action == 'update' && !$cancel) {
64 $error = 0;
65 $MAXDEC = 8;
66 if ($valmainmaxdecimalsunit > $MAXDEC
67 || $valmainmaxdecimalstot > $MAXDEC
68 || $valmainmaxdecimalsshown > $MAXDEC) {
69 $error++;
70 setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
71 $action = 'edit';
72 }
73
74 if ($valmainmaxdecimalsunit < 0
75 || $valmainmaxdecimalstot < 0
76 || $valmainmaxdecimalsshown < 0) {
77 $langs->load("errors");
78 $error++;
79 setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
80 $action = 'edit';
81 }
82
83 if ($valmainroundingruletot) {
84 if ((float) $valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) {
85 $langs->load("errors");
86 $error++;
87 setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
88 $action = 'edit';
89 }
90 }
91
92 if ((float) $valmainmaxdecimalsshown == 0) {
93 $langs->load("errors");
94 $error++;
95 setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
96 $action = 'edit';
97 }
98 if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
99 $langs->load("errors");
100 $error++;
101 setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
102 $action = 'edit';
103 }
104
105 if (!$error) {
106 dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
107 dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
108 dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
109
110 dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
111
112 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
113 exit;
114 }
115}
116
117
118/*
119 * View
120 */
121
122$form = new Form($db);
123
124$title = $langs->trans("LimitsSetup");
125$help_url = '';
126
127llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-limits');
128
129print load_fiche_titre($title, '', 'title_setup');
130
131$aCurrencies = array($conf->currency); // Default currency always first position
132
133if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
134 require_once DOL_DOCUMENT_ROOT . '/core/lib/multicurrency.lib.php';
135
136 $sql = "SELECT rowid, code FROM " . MAIN_DB_PREFIX . "multicurrency";
137 $sql .= " WHERE entity = " . ((int) $conf->entity);
138 $sql .= " AND code <> '" . $db->escape($conf->currency) . "'"; // Default currency always first position
139 $resql = $db->query($sql);
140 if ($resql) {
141 while ($obj = $db->fetch_object($resql)) {
142 $aCurrencies[] = $obj->code;
143 }
144 }
145
146 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
147 $head = multicurrencyLimitPrepareHead($aCurrencies);
148
149 print dol_get_fiche_head($head, $currencycode, '', -1, '');
150 }
151}
152
153print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
154print "<br>\n";
155
156if ($action == 'edit') {
157 print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
158 print '<input type="hidden" name="token" value="' . newToken() . '">';
159 print '<input type="hidden" name="action" value="update">';
160 if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
161 print '<input type="hidden" name="currencycode" value="' . $currencycode . '">';
162 }
163
164 clearstatcache();
165
166 print '<table class="noborder centpercent">';
167 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
168
169 print '<tr class="oddeven"><td>';
170 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
171 print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
172
173 print '<tr class="oddeven"><td>';
174 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
175 print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
176
177 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
178 print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
179
180 print '<tr class="oddeven"><td>';
181 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
182 print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
183
184 print '</table>';
185
186 print '<div class="center">';
187 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
188 print ' &nbsp; ';
189 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
190 print '</div>';
191 print '<br>';
192
193 print '</form>';
194 print '<br>';
195} else {
196 print '<div class="div-table-responsive-no-min">';
197 print '<table class="noborder centpercent">';
198 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
199
200 print '<tr class="oddeven"><td>';
201 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
202 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'</td></tr>';
203
204 print '<tr class="oddeven"><td>';
205 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
206 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'</td></tr>';
207
208 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
209 print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'</td></tr>';
210
211 print '<tr class="oddeven"><td>';
212 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
213 print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : (getDolGlobalString('MAIN_ROUNDING_RULE_TOT') ? $conf->global->MAIN_ROUNDING_RULE_TOT : '')).'</td></tr>';
214
215 print '</table>';
216 print '</div>';
217
218 print '<div class="tabsAction">';
219 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
220 print '</div>';
221}
222
223if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
224 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
225 print dol_get_fiche_end();
226 }
227}
228
229if (empty($mysoc->country_code)) {
230 $langs->load("errors");
231 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
232 print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
233} else {
234 // Show examples
235 print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
236
237 print '<span class="opacitymedium">'.$langs->trans("NumberFormatForATotalPrice", '1234.56789').':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
238
239 // Always show vat rates with vat 0
240 $s = 2 / 3;
241 $qty = 1;
242 $vat = 0;
243 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
244 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
245 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
246 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
247 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
248
249 $s = 10 / 3;
250 $qty = 1;
251 $vat = 0;
252 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
253 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
254 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
255 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
256 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
257
258 $s = 10 / 3;
259 $qty = 2;
260 $vat = 0;
261 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
262 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
263 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
264 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
265 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
266
267 // Add vat rates examples specific to country
268 $vat_rates = array();
269
270 $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
271 $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
272 $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
273 $sql .= " AND t.entity IN (".getEntity('c_tva').")";
274 $sql .= " ORDER BY t.taux ASC";
275 $resql = $db->query($sql);
276 if ($resql) {
277 $num = $db->num_rows($resql);
278 if ($num) {
279 for ($i = 0; $i < $num; $i++) {
280 $obj = $db->fetch_object($resql);
281 $vat_rates[] = array('vat_rate' => $obj->vat_rate, 'code' => $obj->vat_code, 'localtax_rate1' => $obj->localtax_rate1, 'locltax_rate2' => $obj->localtax_rate2);
282 }
283 }
284 } else {
285 dol_print_error($db);
286 }
287
288 if (count($vat_rates)) {
289 foreach ($vat_rates as $vatarray) {
290 $vat = $vatarray['vat_rate'];
291 for ($qty = 1; $qty <= 2; $qty++) {
292 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
293
294 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
295
296 $s = 10 / 3;
297 $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
298 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
299 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
300 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
301 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
302 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
303 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
304 print "<br>\n";
305 }
306
307 if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) {
308 $qty = '1.234';
309 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
310
311 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
312
313 $s = 10 / 3;
314 $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
315 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
316 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
317 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
318 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
319 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
320 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
321 print "<br>\n";
322 }
323 }
324 } else {
325 // More examples if not specific vat rate found
326 // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
327 // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
328
329 $localtax_array = array();
330
331 $s = 10 / 3;
332 $qty = 1;
333 $vat = 10;
334 $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
335 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
336 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
337 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
338 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
339
340 $s = 10 / 3;
341 $qty = 2;
342 $vat = 10;
343 $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
344 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
345 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
346 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
347 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
348 }
349}
350
351// End of page
352llxFooter();
353$db->close();
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()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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 '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
multicurrencyLimitPrepareHead($aCurrencies)
Prepare array with list of currency tabs.
calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller='', $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='')
Calculate totals (net, vat, ...) of a line.
Definition price.lib.php:88
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.