From 2d2fd172e1548dd24e1719accd0b856cff6a31a0 Mon Sep 17 00:00:00 2001 From: Falko Timme <ft@falkotimme.com> Date: Fri, 18 Oct 2013 12:20:13 -0400 Subject: [PATCH] - Added funtion to convert currency formatted numbers back to floating numbers. - Improved getSearchSQL() function so that users can use their native date format so search for dates in lists. --- interface/lib/classes/functions.inc.php | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php index 74f8400..f708834 100644 --- a/interface/lib/classes/functions.inc.php +++ b/interface/lib/classes/functions.inc.php @@ -129,6 +129,20 @@ return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep); } + //* convert currency formatted number back to floating number + public function currency_unformat($number) { + global $app; + + $number_format_dec_point = $app->lng('number_format_dec_point'); + $number_format_thousands_sep = $app->lng('number_format_thousands_sep'); + if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = ''; + + if($number_format_thousands_sep != '') $number = str_replace($number_format_thousands_sep, '', $number); + if($number_format_dec_point != '.' && $number_format_dec_point != '') $number = str_replace($number_format_dec_point, '.', $number); + + return (double)$number; + } + public function get_ispconfig_url() { global $app; -- Gitblit v1.9.1