diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 4dd1f8cae..f78976adb 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -311,25 +311,33 @@ class Config extends Secure_Controller $number_locale = $this->input->post('number_locale'); $fmt = new \NumberFormatter($number_locale, \NumberFormatter::CURRENCY); $currency_symbol = empty($this->input->post('currency_symbol')) ? $fmt->getSymbol(\NumberFormatter::CURRENCY_SYMBOL) : $this->input->post('currency_symbol'); + $currency_code = empty($this->input->post('currency_code')) ? $fmt->getSymbol(\NumberFormatter::CURRENCY_CODE) : $this->input->post('currency_code'); + if($this->input->post('thousands_separator') == 'false') { $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); } + + $fmt->setSymbol(\NumberFormatter::CURRENCY_CODE, $currency_code); $fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $currency_symbol); + $number_local_example = $fmt->format(1234567890.12300); + echo json_encode(array( 'success' => $number_local_example != FALSE, 'number_locale_example' => $number_local_example, + 'currency_code' => $currency_code, 'currency_symbol' => $currency_symbol, 'thousands_separator' => $fmt->getAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL) != '' )); } - + public function save_locale() { $exploded = explode(":", $this->input->post('language')); $batch_save_data = array( 'currency_symbol' => $this->input->post('currency_symbol'), + 'currency_code' => $this->input->post('currency_code'), 'language_code' => $exploded[0], 'language' => $exploded[1], 'timezone' => $this->input->post('timezone'), diff --git a/application/language/en-US/config_lang.php b/application/language/en-US/config_lang.php index 6b69d3700..59628faf5 100644 --- a/application/language/en-US/config_lang.php +++ b/application/language/en-US/config_lang.php @@ -44,6 +44,7 @@ $lang["config_company_select_image"] = "Select Image"; $lang["config_company_website_url"] = "Company website is not a valid URL (http://...)."; $lang["config_country_codes"] = "Country Codes"; $lang["config_country_codes_tooltip"] = "Comma separated list of country codes for nominatim address lookup."; +$lang["config_currency_code"] = "Currency Code"; $lang["config_currency_decimals"] = "Currency Decimals"; $lang["config_currency_symbol"] = "Currency Symbol"; $lang["config_customer_reward"] = "Reward"; diff --git a/application/migrations/20190317102600_add_iso_4217.php b/application/migrations/20190317102600_add_iso_4217.php index eb1ddbfcb..eaea60c86 100644 --- a/application/migrations/20190317102600_add_iso_4217.php +++ b/application/migrations/20190317102600_add_iso_4217.php @@ -17,4 +17,4 @@ class Migration_add_iso_4217 extends CI_Migration } } -?> +?> \ No newline at end of file diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index 3e872c19b..6b4a7f517 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -45,6 +45,17 @@ +