Fix for php8

This commit is contained in:
Laurent Destailleur
2020-12-23 23:06:34 +01:00
parent f8e4985de1
commit 02daf09928
3 changed files with 6 additions and 2 deletions

View File

@@ -4877,7 +4877,7 @@ function price2num($amount, $rounding = '', $option = 0)
elseif ($rounding == 'CR') $nbofdectoround = 8;
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
if (dol_strlen($nbofdectoround)) $amount = round($amount, $nbofdectoround); // $nbofdectoround can be 0.
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
else return 'ErrorBadParameterProvidedToFunction';
//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>';