2
0
forked from Wavyzz/dolibarr

Fix rounding of currency unit prices

This commit is contained in:
Laurent Destailleur
2021-01-11 13:36:53 +01:00
parent 16253a79ee
commit 8debb58f7c
8 changed files with 16 additions and 14 deletions

View File

@@ -4896,8 +4896,11 @@ function price2num($amount, $rounding = '', $option = 0)
elseif ($rounding == 'MS') {
$nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
}
elseif ($rounding == 'CR') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8);
elseif ($rounding == 'CU') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency
}
elseif ($rounding == 'CT') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency
}
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
//print "RR".$amount.' - '.$nbofdectoround.'<br>';