From 1487158082e499ac844e5d0b1613a09a6d3d17e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Jan 2020 12:02:29 +0100 Subject: [PATCH] Update functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index b271a092c90..f9678c2f569 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2356,16 +2356,17 @@ function price2fec($amount) // Clean parameters if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = '' - $amount = (is_numeric($amount)?$amount:0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) + $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) - // Output decimal number by default (french) - $nbdecimal= 2; + // Output decimal number by default + $nbdecimal = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH) ? 2 : $conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH); - // Output separators by default (french) - $dec=','; $thousand=''; + // Output separators by default + $dec = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR) ? ',' : $conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR); + $thousand = (empty($conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR) ? '' : $conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR); // Format number - $output=number_format($amount, $nbdecimal, $dec, $thousand); + $output = number_format($amount, $nbdecimal, $dec, $thousand); return $output; }