dolibarr 25.0.0-alpha
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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
28// Load Dolibarr environment
29require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array('companies', 'products', 'admin'));
43
44$action = GETPOST('action', 'aZ09');
45$cancel = GETPOST('cancel', 'alpha');
46$currencycode = GETPOST('currencycode', 'alpha');
47if (empty($action)) {
48 $action = 'edit';
49}
50if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
51 // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
52 $currencycode = (!empty($currencycode) ? $currencycode : getDolCurrency());
53}
54
55$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
56$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
57$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : '');
58$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : '');
59
60$valmainmaxdecimalsunit = GETPOSTINT($mainmaxdecimalsunit);
61$valmainmaxdecimalstot = GETPOSTINT($mainmaxdecimalstot);
62$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
63$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
64
65if (!$user->admin) {
67}
68
69
70/*
71 * Actions
72 */
73
74if ($action == 'update' && !$cancel) {
75 $error = 0;
76 $MAXDEC = 8;
77 if ($valmainmaxdecimalsunit > $MAXDEC
78 || $valmainmaxdecimalstot > $MAXDEC
79 || $valmainmaxdecimalsshown > $MAXDEC) {
80 $error++;
81 setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
82 $action = 'edit';
83 }
84
85 if ($valmainmaxdecimalsunit < 0
86 || $valmainmaxdecimalstot < 0
87 || $valmainmaxdecimalsshown < 0) {
88 $langs->load("errors");
89 $error++;
90 setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
91 $action = 'edit';
92 }
93
94 if ($valmainroundingruletot) {
95 if ((float) $valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) {
96 $langs->load("errors");
97 $error++;
98 setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
99 $action = 'edit';
100 }
101 }
102
103 if ((float) $valmainmaxdecimalsshown == 0) {
104 $langs->load("errors");
105 $error++;
106 setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
107 $action = 'edit';
108 }
109 if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
110 $langs->load("errors");
111 $error++;
112 setEventMessages($langs->trans("ErrorMaxDecimalsShownTooLowComparedToUnitOrTotal", $valmainmaxdecimalsshown, $valmainmaxdecimalsunit, $valmainmaxdecimalstot), null, 'errors');
113 $action = 'edit';
114 }
115
116 if (!$error) {
117 dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
118 dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
119 dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
120
121 dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
122
123 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
124
125 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
126 exit;
127 }
128}
129
130
131/*
132 * View
133 */
134
135$form = new Form($db);
136
137$title = $langs->trans("LimitsSetup");
138$help_url = '';
139
140llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-limits');
141
142print load_fiche_titre($title, '', 'title_setup');
143
144$aCurrencies = array(getDolCurrency()); // Default currency always first position
145
146if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
147 require_once DOL_DOCUMENT_ROOT . '/core/lib/multicurrency.lib.php';
148
149 $sql = "SELECT rowid, code FROM " . MAIN_DB_PREFIX . "multicurrency";
150 $sql .= " WHERE entity = " . ((int) $conf->entity);
151 $sql .= " AND code <> '" . $db->escape(getDolCurrency()) . "'"; // Default currency always first position
152 $resql = $db->query($sql);
153 if ($resql) {
154 while ($obj = $db->fetch_object($resql)) {
155 $aCurrencies[] = $obj->code;
156 }
157 }
158
159 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
160 $head = multicurrencyLimitPrepareHead($aCurrencies);
161
162 print dol_get_fiche_head($head, $currencycode, '', -1, '');
163 }
164}
165
166print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
167print "<br>\n";
168
169if ($action == 'edit') {
170 print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
171 print '<input type="hidden" name="token" value="' . newToken() . '">';
172 print '<input type="hidden" name="action" value="update">';
173 if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
174 print '<input type="hidden" name="currencycode" value="' . $currencycode . '">';
175 }
176
177 clearstatcache();
178
179 print '<table class="noborder centpercent">';
180 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td></td></tr>';
181
182 print '<tr class="oddeven"><td>';
183 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
184 print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
185
186 print '<tr class="oddeven"><td>';
187 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
188 print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
189
190 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
191 print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
192
193 print '<tr class="oddeven"><td>';
194 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
195 print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
196
197 print '</table>';
198
199 print '<div class="center">';
200 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
201 /*
202 print ' &nbsp; ';
203 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
204 */
205 print '</div>';
206 print '<br>';
207
208 print '</form>';
209 print '<br>';
210} else {
211 print '<div class="div-table-responsive-no-min">';
212 print '<table class="noborder centpercent">';
213 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right"></td></tr>';
214
215 print '<tr class="oddeven"><td>';
216 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
217 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : getDolGlobalString("MAIN_MAX_DECIMALS_UNIT")).'</td></tr>';
218
219 print '<tr class="oddeven"><td>';
220 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
221 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : getDolGlobalString("MAIN_MAX_DECIMALS_TOT")).'</td></tr>';
222
223 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
224 print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : getDolGlobalString("MAIN_MAX_DECIMALS_SHOWN")).'</td></tr>';
225
226 print '<tr class="oddeven"><td>';
227 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
228 print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'</td></tr>';
229
230 print '</table>';
231 print '</div>';
232
233 print '<div class="tabsAction">';
234 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
235 print '</div>';
236}
237
238if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
239 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
240 print dol_get_fiche_end();
241 }
242}
243
244if (empty($mysoc->country_code)) {
245 $langs->load("errors");
246 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
247 print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
248} else {
249 // Show examples
250 print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
251
252 print '<div class="small">';
253
254 print '<span class="opacitymedium">'.$langs->trans("NumberFormatForATotalPrice", '1234.56789').':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
255
256 // Always show vat rates with vat 0
257 $s = 2 / 3;
258 $qty = 1;
259 $vat = 0;
260 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
261 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
262 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
263 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
264 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
265
266 $s = 10 / 3;
267 $qty = 1;
268 $vat = 0;
269 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
270 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
271 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
272 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
273 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
274
275 $s = 10 / 3;
276 $qty = 2;
277 $vat = 0;
278 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
279 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
280 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
281 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
282 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
283
284 // Add vat rates examples specific to country
285 $vat_rates = array();
286
287 $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
288 $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
289 $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')";
290 $sql .= " AND t.entity IN (".getEntity('c_tva').")";
291 $sql .= " ORDER BY t.taux ASC";
292 $resql = $db->query($sql);
293 if ($resql) {
294 $num = $db->num_rows($resql);
295 if ($num) {
296 for ($i = 0; $i < $num; $i++) {
297 $obj = $db->fetch_object($resql);
298 $vat_rates[] = array('vat_rate' => $obj->vat_rate, 'code' => $obj->vat_code, 'localtax_rate1' => $obj->localtax_rate1, 'locltax_rate2' => $obj->localtax_rate2);
299 }
300 }
301 } else {
303 }
304
305 if (count($vat_rates)) {
306 foreach ($vat_rates as $vatarray) {
307 $vat = $vatarray['vat_rate'];
308 for ($qty = 1; $qty <= 2; $qty++) {
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, (float) 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 if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) {
325 $qty = 1.234;
326 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
327
328 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
329
330 $s = 10 / 3;
331 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
332 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
333 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
334 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
335 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
336 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
337 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
338 print "<br>\n";
339 }
340 }
341 } else {
342 // More examples if not specific vat rate found
343 // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
344 // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
345
346 $localtax_array = array();
347
348 $s = 10 / 3;
349 $qty = 1;
350 $vat = 10;
351 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
352 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
353 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
354 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
355 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
356
357 $s = 10 / 3;
358 $qty = 2;
359 $vat = 10;
360 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
361 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
362 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
363 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
364 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
365 }
366
367 print '</div>';
368}
369
370// End of page
371llxFooter();
372$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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
Class to manage generation of HTML components Only common components must be here.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
multicurrencyLimitPrepareHead($aCurrencies)
Prepare array with list of currency tabs.
calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $notused, $price_base_type, $info_bits, $type, $seller=null, $localtaxes_array=[], $progress=100, $multicurrency_tx=1, $pu_devise=0, $multicurrency_code='')
Calculate totals (net, vat, ...) of a line.
Definition price.lib.php:90
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.