mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
Augmentation des decimales suivants bug #17811
This commit is contained in:
@@ -1789,14 +1789,29 @@ function price($amount, $html=0, $outlangs='')
|
||||
if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand");
|
||||
//print "x".$langs->trans("SeparatorThousand")."x";
|
||||
|
||||
// On pose par defaut 2 decimales
|
||||
$decimal = 2;
|
||||
$amount = ereg_replace(',','.',$amount);
|
||||
$datas = explode('.',$amount);
|
||||
$cents = $datas[1];
|
||||
// On augmente au besoin
|
||||
if ($cents > 99 )
|
||||
{
|
||||
$decimal = 3;
|
||||
}
|
||||
if ($cents > 999 )
|
||||
{
|
||||
$decimal = 4;
|
||||
}
|
||||
|
||||
// Formate nombre
|
||||
if ($html)
|
||||
{
|
||||
return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand));
|
||||
return ereg_replace(' ',' ',number_format($amount, $decimal, $dec, $thousand));
|
||||
}
|
||||
else
|
||||
{
|
||||
return number_format($amount, 2, $dec, $thousand);
|
||||
return number_format($amount, $decimal, $dec, $thousand);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user