2
0
forked from Wavyzz/dolibarr

FIX Backport fix fatal error on price with some truncating setup

This commit is contained in:
Laurent Destailleur
2024-10-06 22:17:26 +02:00
parent 9af212a542
commit 63d4b5e3d8

View File

@@ -5931,9 +5931,10 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
$nbdecimal = dol_strlen($decpart);
}
// Si on depasse max
if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN) {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_SHOWN;
if (preg_match('/\.\.\./i', $conf->global->MAIN_MAX_DECIMALS_SHOWN)) {
$max_nbdecimal = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
if ($trunc && $nbdecimal > $max_nbdecimal) {
$nbdecimal = $max_nbdecimal;
if (preg_match('/\.\.\./i', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'))) {
// Si un affichage est tronque, on montre des ...
$end = '...';
}