From 0df017047c8b5bd8ba46af03f702a1de1c07a496 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Aug 2006 22:20:17 +0000 Subject: [PATCH] Gestion format nombre selon langue --- htdocs/lib/functions.inc.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index c806304b423..61ab229647a 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -1710,21 +1710,22 @@ function print_duree_select($prefix) \remarks Fonction utilisée dans les pdf et les pages html \param amount Montant a formater \param html Formatage html ou pas (0 par defaut) - \param langs Objet langs + \param outlangs Objet langs pour formatage \seealso price2num Fonction inverse de price */ -function price($amount, $html=0, $langs='') +function price($amount, $html=0, $outlangs='') { + global $langs; + // Separateurs par defaut $dec='.'; $thousand=' '; - // Si $langs defini - if (is_object($langs)) - { - if ($langs->trans("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->trans("SeparatorDecimal"); - if ($langs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->trans("SeparatorThousand"); - //print "x".$langs->trans("SeparatorThousand")."x"; - } + // Si $outlangs non force, on prend langue utilisateur + if (! is_object($outlangs)) $outlangs=$langs; + + if ($outlangs->trans("SeparatorDecimal") != "SeparatorDecimal") $dec=$outlangs->trans("SeparatorDecimal"); + if ($outlangs->trans("SeparatorThousand")!= "SeparatorThousand") $thousand=$outlangs->trans("SeparatorThousand"); + //print "x".$langs->trans("SeparatorThousand")."x"; // Formate nombre if ($html)