mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 18:48:22 +01:00
Fix price2num on all GETPOST('remise_percent')
This commit is contained in:
@@ -4830,13 +4830,13 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
|
||||
* should be roundtext2num().
|
||||
*
|
||||
* @param string|float $amount Amount to convert/clean or round
|
||||
* @param string $rounding ''=No rounding
|
||||
* @param string|int $rounding ''=No rounding
|
||||
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
|
||||
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
|
||||
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
|
||||
* 'CU'=Round to Max unit price of foreign currency accuracy
|
||||
* 'CT'=Round to Max for totals with Tax of foreign currency accuracy
|
||||
* Numeric = Nb of digits for rounding
|
||||
* Numeric = Nb of digits for rounding (For example 2 for a percentage)
|
||||
* @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
|
||||
* Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator).
|
||||
* @return string Amount with universal numeric format (Example: '99.99999').
|
||||
@@ -4911,7 +4911,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
elseif ($rounding == 'CT') {
|
||||
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency
|
||||
}
|
||||
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
|
||||
elseif (is_numeric($rounding)) $nbofdectoround = (int) $rounding;
|
||||
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
|
||||
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
|
||||
else return 'ErrorBadParameterProvidedToFunction';
|
||||
|
||||
Reference in New Issue
Block a user