forked from Wavyzz/dolibarr
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");
|
if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand");
|
||||||
//print "x".$langs->trans("SeparatorThousand")."x";
|
//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
|
// Formate nombre
|
||||||
if ($html)
|
if ($html)
|
||||||
{
|
{
|
||||||
return ereg_replace(' ',' ',number_format($amount, 2, $dec, $thousand));
|
return ereg_replace(' ',' ',number_format($amount, $decimal, $dec, $thousand));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return number_format($amount, 2, $dec, $thousand);
|
return number_format($amount, $decimal, $dec, $thousand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user