This commit is contained in:
Laurent Destailleur
2024-08-27 03:30:24 +02:00
parent 7023061cd8
commit 93e8d2baba

View File

@@ -6127,11 +6127,12 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
if (dol_strlen($decpart) > $nbdecimal) {
$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)) {
// Si un affichage est tronque, on montre des ...
// If nbdecimal is higher than max to show
$nbdecimalmaxshown = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
if ($trunc && $nbdecimal > $nbdecimalmaxshown) {
$nbdecimal = $nbdecimalmaxshown;
if (preg_match('/\.\.\./i', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'))) {
// If output is truncated, we show ...
$end = '...';
}
}
@@ -6139,9 +6140,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
// If force rounding
if ((string) $forcerounding != '-1') {
if ($forcerounding === 'MU') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
$nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT');
} elseif ($forcerounding === 'MT') {
$nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
$nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_TOT');
} elseif ($forcerounding >= 0) {
$nbdecimal = $forcerounding;
}