From 22147612539ed72540cfb979c6767a4a7cbba177 Mon Sep 17 00:00:00 2001 From: tbrehm Date: Thu, 20 Jan 2011 16:20:33 +0000 Subject: [PATCH] Added global currency format settings in $conf array. --- install/tpl/config.inc.php.master | 5 +++++ interface/lib/classes/listform.inc.php | 2 +- interface/lib/classes/tform.inc.php | 5 +++-- interface/lib/config.inc.php | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/install/tpl/config.inc.php.master b/install/tpl/config.inc.php.master index 1ce1c888f..86eb65c4b 100644 --- a/install/tpl/config.inc.php.master +++ b/install/tpl/config.inc.php.master @@ -148,6 +148,11 @@ $conf['logo'] = 'themes/default/images/ispc_logo.png'; $conf['language'] = '{language}'; $conf['debug_language'] = false; +//** Currency format +$conf['number_format_decimals'] = 2; +$conf['number_format_dec_point'] = ','; +$conf['number_format_thousands_sep'] = ''; + //** Misc. $conf['interface_logout_url'] = ''; // example: http://www.domain.tld/ diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php index 7ac6f8110..664f9e5e4 100644 --- a/interface/lib/classes/listform.inc.php +++ b/interface/lib/classes/listform.inc.php @@ -329,7 +329,7 @@ class listform { break; case 'CURRENCY': - $record[$key] = number_format($record[$key], 2, ',', ''); + $record[$key] = number_format($record[$key], $conf['number_format_decimals'], $conf['number_format_dec_point'], $conf['number_format_thousands_sep']); break; default: diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 95374300c..a164e83cd 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -163,7 +163,8 @@ class tform { * @return record */ function decode($record,$tab) { - if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab)."); + global $conf; + if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab)."); $new_record = ''; if(is_array($record)) { foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) { @@ -198,7 +199,7 @@ class tform { break; case 'CURRENCY': - $new_record[$key] = number_format((double)$record[$key], 2, ',', ''); + $new_record[$key] = number_format((double)$record[$key], $conf['number_format_decimals'], $conf['number_format_dec_point'], $conf['number_format_thousands_sep']); break; default: diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php index c6250c536..b601a8733 100644 --- a/interface/lib/config.inc.php +++ b/interface/lib/config.inc.php @@ -133,6 +133,11 @@ $conf['logo'] = 'themes/default/images/ispc_logo.png'; $conf['language'] = 'en'; $conf['debug_language'] = false; +//** Currency formatting +$conf['number_format_decimals'] = 2; +$conf['number_format_dec_point'] = ','; +$conf['number_format_thousands_sep'] = ''; + //** Misc. $conf['interface_logout_url'] = ''; // example: http://www.domain.tld/ -- GitLab