Add ISO currency code

This commit is contained in:
objecttothis committed 2019-03-08 11:48:38 +04:00
1 parent 34d3352d73
commit f284823707
4 files changed
+23 -3

No files matched your search

+9 -1
View File
@@ -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'),
@@ -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";
@@ -17,4 +17,4 @@ class Migration_add_iso_4217 extends CI_Migration
}
}
?>
?>
+12 -1
View File
@@ -45,6 +45,17 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_currency_code'), 'currency_code', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-1'>
<?php echo form_input(array(
'name' => 'currency_code',
'id' => 'currency_code',
'class' => 'form-control input-sm number_locale',
'value'=>$this->config->item('currency_code'))); ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_currency_decimals'), 'currency_decimals', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
@@ -229,7 +240,7 @@ $(document).ready(function()
{
$('span').tooltip();
$('#currency_symbol, #thousands_separator').change(function() {
$('#currency_symbol, #thousands_separator, #currency_code').change(function() {
var field = $(this).attr('id');
var value = $(this).is(':checkbox') ? $(this).is(':checked') : $(this).val();
var data = { number_locale: $('#number_locale').val() };