diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index df120e90d09..742c3ac721c 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -38,6 +38,7 @@ */ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; class AccountancyExport { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0ec230d1b87..a16faa50f46 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4523,36 +4523,6 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) return $amount; } -/** - * Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals) - * Function used into accountancy FEC export - * - * @param float $amount Amount to format - * @return string Chain with formatted upright - * - * @see price2num() Revert function of price2fec - */ -function price2fec($amount) -{ - global $conf; - - // 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) - - // Output decimal number by default (french) - $nbdecimal= 2; - - // Output separators by default (french) - $dec=','; $thousand=''; - - // Format number - $output=number_format($amount, $nbdecimal, $dec, $thousand); - - return $output; -} - - /** * Output a dimension with best unit * diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 41d8758cca0..b271a092c90 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2340,3 +2340,32 @@ function random_color($min=0, $max=255) { return random_color_part($min, $max) . random_color_part($min, $max) . random_color_part($min, $max); } + +/** + * Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals) + * Function used into accountancy FEC export + * + * @param float $amount Amount to format + * @return string Chain with formatted upright + * + * @see price2num() Revert function of price2fec + */ +function price2fec($amount) +{ + global $conf; + + // 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) + + // Output decimal number by default (french) + $nbdecimal= 2; + + // Output separators by default (french) + $dec=','; $thousand=''; + + // Format number + $output=number_format($amount, $nbdecimal, $dec, $thousand); + + return $output; +}