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$mainmaxdecimalscurrencyrate = 'MAIN_MAX_DECIMALS_CURRENCY_RATE' . (!empty($currencycode) ? '_' . $currencycode : '');
60
61$valmainmaxdecimalsunit = GETPOSTINT($mainmaxdecimalsunit);
62$valmainmaxdecimalstot = GETPOSTINT($mainmaxdecimalstot);
63$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...'
64$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
65$valmainmaxdecimalscurrencyrate = GETPOSTINT($mainmaxdecimalscurrencyrate);
66
67if (!$user->admin) {
69}
70
71
72/*
73 * Actions
74 */
75
76if ($action == 'update' && !$cancel) {
77 $error = 0;
78 $MAXDEC = 8;
79 if ($valmainmaxdecimalsunit > $MAXDEC
80 || $valmainmaxdecimalstot > $MAXDEC
81 || $valmainmaxdecimalsshown > $MAXDEC) {
82 $error++;
83 setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
84 $action = 'edit';
85 }
86
87 if ($valmainmaxdecimalsunit < 0
88 || $valmainmaxdecimalstot < 0
89 || $valmainmaxdecimalsshown < 0) {
90 $langs->load("errors");
91 $error++;
92 setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
93 $action = 'edit';
94 }
95
96 if ($valmainroundingruletot) {
97 if ((float) $valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) {
98 $langs->load("errors");
99 $error++;
100 setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
101 $action = 'edit';
102 }
103 }
104
105 if ((float) $valmainmaxdecimalsshown == 0) {
106 $langs->load("errors");
107 $error++;
108 setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors');
109 $action = 'edit';
110 }
111 if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) {
112 $langs->load("errors");
113 $error++;
114 setEventMessages($langs->trans("ErrorMaxDecimalsShownTooLowComparedToUnitOrTotal", $valmainmaxdecimalsshown, $valmainmaxdecimalsunit, $valmainmaxdecimalstot), null, 'errors');
115 $action = 'edit';
116 }
117
118 if ($valmainmaxdecimalscurrencyrate < 0) {
119 $valmainmaxdecimalscurrencyrate = 0;
120 }
121 if ($valmainmaxdecimalscurrencyrate > $MAXDEC) {
122 $valmainmaxdecimalscurrencyrate = $MAXDEC;
123 }
124
125 if (!$error) {
126 dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
127 dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
128 dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
129
130 dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
131 dolibarr_set_const($db, $mainmaxdecimalscurrencyrate, $valmainmaxdecimalscurrencyrate, 'chaine', 0, '', $conf->entity);
132
133 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
134
135 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
136 exit;
137 }
138}
139
140
141/*
142 * View
143 */
144
145$form = new Form($db);
146
147$title = $langs->trans("LimitsSetup");
148$help_url = '';
149
150llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-limits');
151
152print load_fiche_titre($title, '', 'title_setup');
153
154$aCurrencies = array(getDolCurrency()); // Default currency always first position
155
156if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
157 require_once DOL_DOCUMENT_ROOT . '/core/lib/multicurrency.lib.php';
158
159 $sql = "SELECT rowid, code FROM " . MAIN_DB_PREFIX . "multicurrency";
160 $sql .= " WHERE entity = " . ((int) $conf->entity);
161 $sql .= " AND code <> '" . $db->escape(getDolCurrency()) . "'"; // Default currency always first position
162 $resql = $db->query($sql);
163 if ($resql) {
164 while ($obj = $db->fetch_object($resql)) {
165 $aCurrencies[] = $obj->code;
166 }
167 }
168
169 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
170 $head = multicurrencyLimitPrepareHead($aCurrencies);
171
172 print dol_get_fiche_head($head, $currencycode, '', -1, '');
173 }
174}
175
176print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
177print "<br>\n";
178
179if ($action == 'edit') {
180 print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '" spellcheck="false">';
181 print '<input type="hidden" name="token" value="' . newToken() . '">';
182 print '<input type="hidden" name="action" value="update">';
183 if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
184 print '<input type="hidden" name="currencycode" value="' . $currencycode . '">';
185 }
186
187 clearstatcache();
188
189 print '<table class="noborder centpercent">';
190 print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td></td></tr>';
191
192 print '<tr class="oddeven"><td>';
193 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
194 print '</td><td><input class="flat right" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsunit) ? GETPOST($mainmaxdecimalsunit) : getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT', 0)).'"></td></tr>';
195
196 print '<tr class="oddeven"><td>';
197 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
198 print '</td><td><input class="flat right" name="'.$mainmaxdecimalstot.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalstot) ? GETPOST($mainmaxdecimalstot) : getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)).'"></td></tr>';
199
200 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
201 print '<td><input class="flat right" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(GETPOSTISSET($mainmaxdecimalsshown) ? GETPOST($mainmaxdecimalsshown) : getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')).'"></td></tr>';
202
203 print '<tr class="oddeven"><td>';
204 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
205 print '</td><td><input class="flat right" name="'.$mainroundingruletot.'" size="3" value="'.(GETPOSTISSET($mainroundingruletot) ? GETPOST($mainroundingruletot) : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'"></td></tr>';
206
207 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans('MAIN_MAX_DECIMALS_CURRENCY_RATE'), $langs->trans('MAIN_MAX_DECIMALS_CURRENCY_RATE_Help')) . '</td>';
208 print '<td><input class="flat right" name="' . $mainmaxdecimalscurrencyrate . '" size="3" value="' . (GETPOSTISSET($mainmaxdecimalscurrencyrate) ? GETPOST($mainmaxdecimalscurrencyrate) : getDolGlobalInt($mainmaxdecimalscurrencyrate, 8)) . '"></td></tr>';
209
210 print '</table>';
211
212 print '<div class="center">';
213 print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
214 /*
215 print ' &nbsp; ';
216 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
217 */
218 print '</div>';
219 print '<br>';
220
221 print '</form>';
222 print '<br>';
223} else {
224 print '<div class="div-table-responsive-no-min">';
225 print '<table class="noborder centpercent">';
226 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="right"></td></tr>';
227
228 print '<tr class="oddeven"><td>';
229 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
230 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : getDolGlobalString("MAIN_MAX_DECIMALS_UNIT")).'</td></tr>';
231
232 print '<tr class="oddeven"><td>';
233 print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
234 print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : getDolGlobalString("MAIN_MAX_DECIMALS_TOT")).'</td></tr>';
235
236 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
237 print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : getDolGlobalString("MAIN_MAX_DECIMALS_SHOWN")).'</td></tr>';
238
239 print '<tr class="oddeven"><td>';
240 print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
241 print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : getDolGlobalString('MAIN_ROUNDING_RULE_TOT')).'</td></tr>';
242
243 print '</table>';
244 print '</div>';
245
246 print '<div class="tabsAction">';
247 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
248 print '</div>';
249}
250
251if (isModEnabled('multicompany') && getDolGlobalString('MULTICURRENCY_USE_LIMIT_BY_CURRENCY')) {
252 if (!empty($aCurrencies) && count($aCurrencies) > 1) {
253 print dol_get_fiche_end();
254 }
255}
256
257if (empty($mysoc->country_code)) {
258 $langs->load("errors");
259 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
260 print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
261} else {
262 // Show examples
263 print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
264
265 print '<div class="small">';
266
267 print '<span class="opacitymedium">'.$langs->trans("NumberFormatForATotalPrice", '1234.56789').':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
268
269 // Always show vat rates with vat 0
270 $s = 2 / 3;
271 $qty = 1;
272 $vat = 0;
273 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
274 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
275 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
276 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
277 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
278
279 $s = 10 / 3;
280 $qty = 1;
281 $vat = 0;
282 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
283 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
284 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
285 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
286 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
287
288 $s = 10 / 3;
289 $qty = 2;
290 $vat = 0;
291 $tmparray = calcul_price_total(1, $qty * (float) price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
292 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
293 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
294 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
295 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
296
297 // Add vat rates examples specific to country
298 $vat_rates = array();
299
300 $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
301 $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
302 $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')";
303 $sql .= " AND t.entity IN (".getEntity('c_tva').")";
304 $sql .= " ORDER BY t.taux ASC";
305 $resql = $db->query($sql);
306 if ($resql) {
307 $num = $db->num_rows($resql);
308 if ($num) {
309 for ($i = 0; $i < $num; $i++) {
310 $obj = $db->fetch_object($resql);
311 $vat_rates[] = array('vat_rate' => $obj->vat_rate, 'code' => $obj->vat_code, 'localtax_rate1' => $obj->localtax_rate1, 'locltax_rate2' => $obj->localtax_rate2);
312 }
313 }
314 } else {
315 dol_print_error($db);
316 }
317
318 if (count($vat_rates)) {
319 foreach ($vat_rates as $vatarray) {
320 $vat = $vatarray['vat_rate'];
321 for ($qty = 1; $qty <= 2; $qty++) {
322 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
323
324 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
325
326 $s = 10 / 3;
327 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
328 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
329 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
330 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
331 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
332 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
333 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
334 print "<br>\n";
335 }
336
337 if (getDolGlobalString('MAIN_ADD_MORE_EXAMPLE_IN_ACCURANCY_SETUP')) {
338 $qty = 1.234;
339 $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
340
341 $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
342
343 $s = 10 / 3;
344 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
345 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
346 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
347 print ' - <span class="opacitymedium">'.$langs->trans("VAT").':</span> '.$vat.'%';
348 print($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
349 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
350 print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
351 print "<br>\n";
352 }
353 }
354 } else {
355 // More examples if not specific vat rate found
356 // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
357 // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
358
359 $localtax_array = array();
360
361 $s = 10 / 3;
362 $qty = 1;
363 $vat = 10;
364 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
365 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
366 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
367 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
368 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
369
370 $s = 10 / 3;
371 $qty = 2;
372 $vat = 10;
373 $tmparray = calcul_price_total($qty, (float) price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
374 print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
375 print ' x <span class="opacitymedium">'.$langs->trans("Quantity").":</span> ".$qty;
376 print ' - <span class="opacitymedium">'.$langs->trans("VAT").":</span> ".$vat.'%';
377 print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
378 }
379
380 print '</div>';
381}
382
383// End of page
384llxFooter();
385$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:
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 '.
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_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.
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.
Definition html.lib.php:540
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:738
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.