Fix decimal parsing, add php5-intl locale support (#458)

This commit is contained in:
jekkos
2016-07-07 20:51:44 +02:00
parent f11c2d7a4d
commit 3af19daa0e
36 changed files with 260 additions and 172 deletions

View File

@@ -32,13 +32,14 @@ Please also make sure you have updated all the files from latest master.
Bug reports must follow this schema:
1. OS name and version running your Web Server (e.g. Linux Ubuntu 15.0)
2. Web Server name and version (e.g. Apache 2.4)
3. Database name and version (e.g. MySQL 5.6)
3. PHP version (e.g. PHP 5.5)
4. Language selected in OSPOS (e.g. English, Spanish)
5. Any configuration of OSPOS that you changed
6. Exact steps to reproduce the issue (test case)
1. OSPOS **version string with git commit hash** (see footer)
2. OS name and version running your Web Server (e.g. Linux Ubuntu 15.0)
3. Web Server name and version (e.g. Apache 2.4)
4. Database name and version (e.g. MySQL 5.6)
5. PHP version (e.g. PHP 5.5)
6. Language selected in OSPOS (e.g. English, Spanish)
7. Any configuration of OSPOS that you changed
8. Exact steps to reproduce the issue (test case)
If above information is not provided in full, your issue will be tagged as pending.
If missing information is not provided within a week we will close your issue.

View File

@@ -0,0 +1,15 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| theme name
|--------------------------------------------------------------------------
|
| the theme folder name. If the folder doesn't exist it will use default theme
|
| The default theme for OSPOS is flatly: http://bootswatch.com/flatly/
|
|
*/
//$config['theme_name'] = 'spacelab';

View File

@@ -85,17 +85,25 @@ class Config extends Secure_Controller
echo json_encode(array('success' => $success, 'message' => $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully')));
}
function check_number_locale()
{
$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');
$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_symbol' => $currency_symbol));
}
function save_locale()
{
$batch_save_data = array(
$batch_save_data = array(
'currency_symbol' => $this->input->post('currency_symbol'),
'currency_side' => $this->input->post('currency_side') != NULL,
'language' => $this->input->post('language'),
'timezone' => $this->input->post('timezone'),
'dateformat' => $this->input->post('dateformat'),
'timeformat' => $this->input->post('timeformat'),
'thousands_separator' => $this->input->post('thousands_separator'),
'decimal_point' => $this->input->post('decimal_point'),
'number_locale' => $this->input->post('number_locale'),
'currency_decimals' => $this->input->post('currency_decimals'),
'tax_decimals' => $this->input->post('tax_decimals'),
'quantity_decimals' => $this->input->post('quantity_decimals'),

View File

@@ -322,8 +322,8 @@ class Items extends Secure_Controller
'category' => $this->input->post('category'),
'supplier_id' => $this->input->post('supplier_id') == '' ? NULL : $this->input->post('supplier_id'),
'item_number' => $this->input->post('item_number') == '' ? NULL : $this->input->post('item_number'),
'cost_price' => $this->input->post('cost_price'),
'unit_price' => $this->input->post('unit_price'),
'cost_price' => parse_decimals($this->input->post('cost_price')),
'unit_price' => parse_decimals($this->input->post('unit_price')),
'reorder_level' => $this->input->post('reorder_level'),
'receiving_quantity' => $this->input->post('receiving_quantity'),
'allow_alt_description' => $this->input->post('allow_alt_description') != NULL,

View File

@@ -99,19 +99,24 @@ class Receivings extends Secure_Controller
$this->_reload($data);
}
function numeric($str)
{
return (bool) preg_match('/^[\-+]?[0-9]*[\.,]?[0-9]+$/', $str);
}
public function edit_item($item_id)
{
$data = array();
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|numeric');
$this->form_validation->set_rules('price', 'lang:items_price', 'required|callback_numeric');
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|callback_numeric');
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|callback_numeric');
$description = $this->input->post('description');
$serialnumber = $this->input->post('serialnumber');
$price = $this->input->post('price');
$quantity = $this->input->post('quantity');
$discount = $this->input->post('discount');
$price = parse_decimals($this->input->post('price'));
$quantity = parse_decimals($this->input->post('quantity'));
$discount = parse_decimals($this->input->post('discount'));
$item_location = $this->input->post('location');
if($this->form_validation->run() != FALSE)

View File

@@ -183,7 +183,7 @@ class Sales extends Secure_Controller
$this->form_validation->set_rules('amount_tendered', 'lang:sales_amount_tendered', 'trim|required|numeric');
$payment_type = $this->input->post('payment_type');
$amount_tendered = $this->input->post('amount_tendered');
$amount_tendered = parse_decimals($this->input->post('amount_tendered'));
if($this->form_validation->run() == FALSE)
{
@@ -280,19 +280,24 @@ class Sales extends Secure_Controller
$this->_reload($data);
}
function numeric($str)
{
return (bool) preg_match('/^[\-+]?[0-9]*[\.,]?[0-9]+$/', $str);
}
public function edit_item($item_id)
{
$data = array();
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|numeric');
$this->form_validation->set_rules('price', 'lang:items_price', 'required|callback_numeric');
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|callback_numeric');
$this->form_validation->set_rules('discount', 'lang:items_discount', 'required|callback_numeric');
$description = $this->input->post('description');
$serialnumber = $this->input->post('serialnumber');
$price = $this->input->post('price');
$quantity = $this->input->post('quantity');
$discount = $this->input->post('discount');
$price = parse_decimals($this->input->post('price'));
$quantity = parse_decimals($this->input->post('quantity'));
$discount = parse_decimals($this->input->post('discount'));
$item_location = $this->input->post('location');
if($this->form_validation->run() != FALSE)

View File

@@ -4,113 +4,65 @@
* Currency locale
*/
function to_currency($number, $escape = FALSE)
function currency_side()
{
$CI =& get_instance();
$currency_symbol = $CI->config->item('currency_symbol') ? $CI->config->item('currency_symbol') : '$';
$currency_symbol = $currency_symbol == '$' && $escape ? '\$' : $currency_symbol;
$thousands_separator = $CI->config->item('thousands_separator') ? $CI->config->item('thousands_separator') : '';
$decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.';
$decimals = $CI->config->item('currency_decimals') ? $CI->config->item('currency_decimals') : 0;
// the conversion function needs a non null var, so if the number is null set it to 0
if(empty($number))
{
$number = 0;
}
if($number >= 0)
{
if(!$CI->config->item('currency_side'))
{
return $currency_symbol.number_format($number, $decimals, $decimal_point, $thousands_separator);
}
else
{
return number_format($number, $decimals, $decimal_point, $thousands_separator).$currency_symbol;
}
}
else
{
if(!$CI->config->item('currency_side'))
{
return '-'.$currency_symbol.number_format(abs($number), $decimals, $decimal_point, $thousands_separator);
}
else
{
return '-'.number_format(abs($number), $decimals, $decimal_point, $thousands_separator).$currency_symbol;
}
}
}
function to_currency_no_money($number)
{
// ignore empty strings as they are just for empty input
if(empty($number))
{
return $number;
}
$CI =& get_instance();
$decimals = $CI->config->item('currency_decimals') ? $CI->config->item('currency_decimals') : 0;
return number_format($number, $decimals, '.', '');
$CI =& get_instance();
$fmt = new \NumberFormatter($CI->config->item('number_locale'), \NumberFormatter::CURRENCY);
$fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $CI->config->item('currency_symbol'));
return !preg_match('/^¤/', $fmt->getPattern());
}
function totals_decimals()
{
$CI =& get_instance();
$decimals = $CI->config->item('currency_decimals') ? $CI->config->item('currency_decimals') : 0;
return $decimals;
}
function to_currency($number, $escape = FALSE)
{
return to_decimals($number, 'currency_decimals', \NumberFormatter::CURRENCY);
}
/*
* Tax locale
*/
function to_currency_no_money($number)
{
return to_decimals($number, 'currency_decimals');
}
function to_tax_decimals($number)
{
// ignore empty strings as they are just for empty input
if( empty($number) )
{
return $number;
}
$CI =& get_instance();
$decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.';
$decimals = $CI->config->item('tax_decimals') ? $CI->config->item('tax_decimals') : 0;
return number_format($number, $decimals, $decimal_point, '');
return to_decimals($number, 'tax_decimals');
}
/*
* Quantity decimals
*/
function to_quantity_decimals($number)
{
$CI =& get_instance();
$decimal_point = $CI->config->item('decimal_point') ? $CI->config->item('decimal_point') : '.';
$decimals = $CI->config->item('quantity_decimals') ? $CI->config->item('quantity_decimals') : 0;
return number_format($number, $decimals, $decimal_point, '');
return to_decimals($number, 'quantity_decimals');
}
function quantity_decimals()
function to_decimals($number, $decimals, $type=\NumberFormatter::DECIMAL)
{
$CI =& get_instance();
return $CI->config->item('quantity_decimals') ? $CI->config->item('quantity_decimals') : 0;
$CI =& get_instance();
$fmt = new \NumberFormatter($CI->config->item('number_locale'), $type);
$fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $CI->config->item($decimals));
$fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $CI->config->item($decimals));
$fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $CI->config->item('currency_symbol'));
return $fmt->format(floatval($number));
}
function parse_decimals($number)
{
// ignore empty strings as they are just for empty input
if (empty($number))
{
return $number;
}
$CI =& get_instance();
$fmt = new \NumberFormatter( $CI->config->item('number_locale'), \NumberFormatter::DECIMAL );
$fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $CI->config->item('quantity_decimals'));
$fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $CI->config->item('quantity_decimals'));
return $fmt->parse($number);
}
/*
* Time locale conversion utility

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Tausendertrennzeichen";
$lang["config_timezone"] = "Zeitzone";
$lang["config_top"] = "Top";
$lang["config_website"] = "Website";
$lang["config_number_locale"] = "Länderkonfiguration";
$lang["config_return_policy_required"] = "Rücknahmepolitik erforderlich";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "Timezone";
$lang["config_top"] = "Top";
$lang["config_website"] = "Website";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "Return policy is a required field";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Separador de miles";
$lang["config_timezone"] = "Zona Horaria";
$lang["config_top"] = "Top";
$lang["config_website"] = "Sitio Web";
$lang["config_number_locale"] = "Ubicación";
$lang["config_return_policy_required"] = "Política de Devolución es requerida";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "Fuseau Horaire";
$lang["config_top"] = "Top";
$lang["config_website"] = "Site-web";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "Le Message est un champ requis";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Razdjelnik za tisućice";
$lang["config_timezone"] = "Vremenska zona";
$lang["config_top"] = "Top";
$lang["config_website"] = "web strana";
$lang["config_number_locale"] = "Lokalnoj";
$lang["config_return_policy_required"] = "Polje za povratne obavijesti je potrebno";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Ezres elválasztó";
$lang["config_timezone"] = "Időzóna";
$lang["config_top"] = "Top";
$lang["config_website"] = "Weboldal";
$lang["config_number_locale"] = "Lokalizációs";
$lang["config_return_policy_required"] = "Return policy is a required field";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Pemisah Ribuan";
$lang["config_timezone"] = "Zona Waktu";
$lang["config_top"] = "Top";
$lang["config_website"] = "Situs Perusahaan";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "Kebijakan retur wajib diisi";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "Tijdzone";
$lang["config_top"] = "Top";
$lang["config_website"] = "Website";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "De retourvoorwaarden moeten ingevuld worden";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Separador de milhar";
$lang["config_timezone"] = "Fuso horário";
$lang["config_top"] = "Topo";
$lang["config_website"] = "Site da internet";
$lang["config_number_locale"] = "Localização";
$lang["config_return_policy_required"] = "A política de devolução é um campo obrigatório";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "Часовой пояс";
$lang["config_top"] = "Top";
$lang["config_website"] = "Веб-сайт";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "Возвратний полис обязательный пробел";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "ตัวคั่นหลักพั
$lang["config_timezone"] = "โซนเวลา";
$lang["config_top"] = "Top";
$lang["config_website"] = "เว็บไซต์";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "ต้องกรอกเงื่อนไขการคืนสินค้า";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "Saat Dilimi";
$lang["config_top"] = "Top";
$lang["config_website"] = "Website";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "İade Politikası zorunlu alandır";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -173,3 +173,8 @@ $lang["config_thousands_separator"] = "Thousands Separator";
$lang["config_timezone"] = "時區";
$lang["config_top"] = "Top";
$lang["config_website"] = "網站";
$lang["config_number_locale"] = "Localisation";
$lang["config_return_policy_required"] = "退換貨政策為必填";
$lang["config_number_locale_required"] = "Number Locale is a required field";
$lang["config_number_locale_invalid"] = "The entered locale is invalid. Check the link in the tooltip to find a sensible value";
$lang["config_number_locale_tooltip"] = "Find a suitable locale through this link";

View File

@@ -10,18 +10,27 @@
<?php echo form_input(array(
'name' => 'currency_symbol',
'id' => 'currency_symbol',
'class' => 'form-control input-sm',
'class' => 'form-control input-sm number_locale',
'value'=>$this->config->item('currency_symbol'))); ?>
</div>
<div class='checkbox col-xs-2'>
<label>
<?php echo form_checkbox(array(
'name' => 'currency_side',
'id' => 'currency_side',
'value' => 'currency_side',
'checked'=>$this->config->item('currency_side'))); ?>
<?php echo $this->lang->line('config_currency_side'); ?>
</label>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_number_locale'), 'number_locale', array('class' => 'control-label col-xs-2')); ?>
<div class='form-group'>
<div class='col-xs-1'>
<?php echo form_input('number_locale', $this->config->item('number_locale'), array('class' => 'form-control input-sm', 'id' => 'number_locale')); ?>
</div>
<div class="col-xs-2">
<label class="control-label">
<a href="https://github.com/jekkos/opensourcepos/wiki/Localisation-support" target="_blank">
<span class="glyphicon glyphicon-info-sign" data-toggle="tootltip" data-placement="right" title="<?php echo $this->lang->line('config_number_locale_tooltip'); ?>"></span>
</a>
<span id="number_locale_example">
&nbsp&nbsp<?php echo to_currency(1234567890.12300); ?>
</span>
</label>
</div>
</div>
</div>
@@ -52,32 +61,6 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_decimal_point'), 'decimal_point', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('decimal_point', array(
'.' => '. (' . $this->lang->line('config_dot') . ')',
',' => ', (' . $this->lang->line('config_comma') . ')'
),
$this->config->item('decimal_point'), array('class' => 'form-control input-sm'));
?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_thousands_separator'), 'thousands_separator', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('thousands_separator', array(
'&apos;' => '&apos; (' . $this->lang->line('config_apostrophe') . ')',
',' => ', (' . $this->lang->line('config_comma') . ')',
'.' => '. (' . $this->lang->line('config_dot') . ')',
'' => '(' . $this->lang->line('config_none') . ')'
),
$this->config->item('thousands_separator'), array('class' => 'form-control input-sm'));
?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_quantity_decimals'), 'quantity_decimals', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
@@ -87,7 +70,7 @@
'2' => '2',
'3' => '3'
),
$this->config->item('quantity_decimals'), array('class' => 'form-control input-sm'));
$this->config->item('quantity_decimals'), array('class' => 'form-control input-sm'));
?>
</div>
</div>
@@ -280,7 +263,54 @@
$(document).ready(function()
{
$("span").tooltip();
var number_locale_params = {
url: "<?php echo site_url($controller_name . '/check_number_locale')?>",
type: "POST"
};
$("#currency_symbol").change(function() {
$.post($.extend(number_locale_params, {
data: $.extend(csrf_form_base(), {
"currency_symbol": $("#currency_symbol").val()
}),
success: function(response) {
$("#number_locale_example").text(response.number_locale_example);
}
}));
});
$('#locale_config_form').validate($.extend(form_support.handler, {
rules:
{
number_locale:
{
required: true,
remote: $.extend(number_locale_params, {
data: $.extend(csrf_form_base(), {
"number_locale" : function() {
return $("#number_locale").val();
},
}),
dataFilter: function(data, dataType) {
setup_csrf_token();
var response = JSON.parse(data);
$("#number_locale_example").text(response.number_locale_example);
$("#currency_symbol").val(response.currency_symbol);
return response.success;
}
})
}
},
messages:
{
number_locale: {
required: '<?php echo $this->lang->line('config_number_locale_required') ?>',
number_locale: '<?php echo $this->lang->line('config_number_locale_invalid') ?>'
}
},
errorLabelContainer: "#locale_error_message_box"
}));
});

View File

@@ -33,7 +33,7 @@
<?php echo form_label($this->lang->line('customers_total'), 'total', array('class' => 'control-label col-xs-3')); ?>
<div class="col-xs-4">
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -43,7 +43,7 @@
'value'=>to_currency_no_money($total),
'disabled'=>'')
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>

View File

@@ -33,7 +33,7 @@
<?php echo form_label($this->lang->line('giftcards_card_value'), 'name', array('class'=>'required control-label col-xs-3')); ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -42,7 +42,7 @@
'class'=>'form-control input-sm',
'value'=>to_currency_no_money($giftcard_value))
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>

View File

@@ -57,7 +57,7 @@
<?php echo form_label($this->lang->line('items_cost_price'), 'cost_price', array('class'=>'required control-label col-xs-3')); ?>
<div class="col-xs-4">
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -66,7 +66,7 @@
'class'=>'form-control input-sm',
'value'=>to_currency_no_money($item_info->cost_price))
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>
@@ -77,7 +77,7 @@
<?php echo form_label($this->lang->line('items_unit_price'), 'unit_price', array('class'=>'required control-label col-xs-3')); ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -86,7 +86,7 @@
'class'=>'form-control input-sm',
'value'=>to_currency_no_money($item_info->unit_price))
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>

View File

@@ -40,7 +40,7 @@
<?php echo form_label($this->lang->line('items_cost_price'), 'cost_price', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -48,7 +48,7 @@
'id'=>'cost_price',
'class'=>'form-control input-sm')
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>
@@ -59,7 +59,7 @@
<?php echo form_label($this->lang->line('items_unit_price'), 'unit_price', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if (!$this->config->item('currency_side')): ?>
<?php if (!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array(
@@ -67,7 +67,7 @@
'id'=>'unit_price',
'class'=>'form-control input-sm')
);?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>

View File

@@ -3,8 +3,8 @@
<div id="footer">
<div class="jumbotron push-spaces">
<?php echo $this->lang->line('common_you_are_using_ospos'); ?>
<?php echo $this->config->item('application_version'); ?>.
<strong><?php echo $this->lang->line('common_you_are_using_ospos'); ?>
<?php echo $this->config->item('application_version'); ?> - <?php echo substr($this->config->item('commit_sha1'), 5, 12); ?></strong>.
<?php echo $this->lang->line('common_please_visit_my'); ?>
<a href="https://github.com/jekkos/opensourcepos" target="_blank"><?php echo $this->lang->line('common_website'); ?></a>
<?php echo $this->lang->line('common_learn_about_project'); ?>

View File

@@ -44,4 +44,8 @@
}
});
$.validator.methods.number = function (value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:[\.,]\d+)?$/.test(value);
}
</script>

View File

@@ -40,7 +40,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';

View File

@@ -37,7 +37,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';

View File

@@ -46,7 +46,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
@@ -99,7 +99,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
@@ -128,7 +128,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';

View File

@@ -31,7 +31,7 @@
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
if( currency_side() )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';

View File

@@ -52,11 +52,11 @@
</div>
<div class='col-xs-4'>
<div class="input-group input-group-sm">
<?php if(!$this->config->item('currency_side')): ?>
<?php if(!currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
<?php echo form_input(array('name'=>'payment_amount_'.$i, 'value'=>$row->payment_amount, 'id'=>'payment_amount_'.$i, 'class'=>'form-control input-sm', 'readonly'=>'true'));?>
<?php if ($this->config->item('currency_side')): ?>
<?php if (currency_side()): ?>
<span class="input-group-addon input-sm"><b><?php echo $this->config->item('currency_symbol'); ?></b></span>
<?php endif; ?>
</div>

View File

@@ -163,7 +163,7 @@ if (isset($success))
?>
</td>
<td><?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>$item['discount']));?></td>
<td><?php echo form_input(array('name'=>'discount', 'class'=>'form-control input-sm', 'value'=>to_decimals($item['discount'], 0)));?></td>
<td><?php echo to_currency($item['price']*$item['quantity']-$item['price']*$item['quantity']*$item['discount']/100); ?></td>
<td><a href="javascript:document.getElementById('<?php echo 'cart_'.$line ?>').submit();" title=<?php echo $this->lang->line('sales_update')?> ><span class="glyphicon glyphicon-refresh"></span></a></td>
</tr>

View File

@@ -60,7 +60,6 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('dateformat', 'm/d/Y'),
('timeformat', 'H:i:s'),
('currency_symbol', '$'),
('decimal_point', '.'),
('currency_decimals', '2'),
('tax_decimals', '2'),
('quantity_decimals', '0'),

View File

@@ -60,7 +60,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES
('dateformat', 'm/d/Y'),
('timeformat', 'H:i:s'),
('currency_symbol', '$'),
('decimal_point', '.'),
('number_locale', 'en_US'),
('currency_decimals', '2'),
('tax_decimals', '2'),
('quantity_decimals', '0'),

View File

@@ -38,7 +38,6 @@ config_company_website_url,A cég webcime nem érvényes URL (http://...),Websei
config_comma,comma,comma,comma,comma,comma,comma,comma,comma,comma,comma,comma,Vírgula,comma
config_country_codes,Country Codes,Country Codes,Country Codes,Codigo de pais,Country Codes,Country Codes,Country Codes,Country Codes,Country Codes,Country Codes,Country Codes,Código do país,Country Codes
config_country_codes_tooltip,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Lista de codigo de paises separado por coma para busqueda de direcciones,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Comma separated list of country codes for nominatim address lookup.,Vírgula lista de códigos de país separado para pesquisa de endereços nominatim.,Comma separated list of country codes for nominatim address lookup.
config_currency_side,Jobb oldal,Pos. rechts,Rechterkant,Lado derecho,Right side,Symbole à droite,Right side,Правая сторона,ด้านขวา,Sağda,Sisi Kanan,Lado Direito,Desna strana
config_currency_symbol,Pénznem,Währungssymbol,Valuta,Símbolo de moneda,Currency Symbol,Symbole Monétaire,貨幣符號,Символ валюты,สัญลักษณ์ค่าเงิน,Para Birimi,Simbol Mata Uang,Simbolo moeda,Valutna oznaka
config_currency_decimals,Currency Decimals,Currency Decimals,Currency Decimals,Decimales de moneda,Currency Decimals,Currency Decimals,Currency Decimals,Currency Decimals,Currency Decimals,Currency Decimals,Currency Decimals,Decimais moeda,Velutne decimale
config_custom1,Egyedi mező 1,Zusatzfeld 1,Custom Veld 1,Campo Libre 1,Custom Field 1,Champ Personnalisé 1,Custom Field 1,Изготовленный пробел 1,พื้นที่เพิ่มเติม 1,Özel Alan 1,Custom Field 1,Campo customizado 1,Korisničko polje1
@@ -172,3 +171,8 @@ config_thousands_separator,Ezres elválasztó,Tausendertrennzeichen,Thousands Se
config_timezone,Időzóna,Zeitzone,Tijdzone,Zona Horaria,Timezone,Fuseau Horaire,時區,Часовой пояс,โซนเวลา,Saat Dilimi,Zona Waktu,Fuso horário,Vremenska zona
config_top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Top,Topo,Top
config_website,Weboldal,Website,Website,Sitio Web,Website,Site-web,網站,Веб-сайт,เว็บไซต์,Website,Situs Perusahaan,Site da internet,web strana
config_number_locale,Lokalizációs,Länderkonfiguration,Localisation,Ubicación,Localisation,Localisation,Localisation,Localisation,Localisation,Localisation,Localisation,Localização,Lokalnoj
config_return_policy_required,Return policy is a required field,Rücknahmepolitik erforderlich,De retourvoorwaarden moeten ingevuld worden,Política de Devolución es requerida,Return policy is a required field,Le Message est un champ requis,退換貨政策為必填,Возвратний полис обязательный пробел,ต้องกรอกเงื่อนไขการคืนสินค้า,İade Politikası zorunlu alandır,Kebijakan retur wajib diisi,A política de devolução é um campo obrigatório,Polje za povratne obavijesti je potrebno
config_number_locale_required,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field,Number Locale is a required field
config_number_locale_invalid,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value,The entered locale is invalid. Check the link in the tooltip to find a sensible value
config_number_locale_tooltip,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link,Find a suitable locale through this link
1 label hu-HU de-CH nl-BE es en fr zh ru th tr id pt-BR hr-HR
38 config_comma comma comma comma comma comma comma comma comma comma comma comma Vírgula comma
39 config_country_codes Country Codes Country Codes Country Codes Codigo de pais Country Codes Country Codes Country Codes Country Codes Country Codes Country Codes Country Codes Código do país Country Codes
40 config_country_codes_tooltip Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Lista de codigo de paises separado por coma para busqueda de direcciones Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Comma separated list of country codes for nominatim address lookup. Vírgula lista de códigos de país separado para pesquisa de endereços nominatim. Comma separated list of country codes for nominatim address lookup.
config_currency_side Jobb oldal Pos. rechts Rechterkant Lado derecho Right side Symbole à droite Right side Правая сторона ด้านขวา Sağda Sisi Kanan Lado Direito Desna strana
41 config_currency_symbol Pénznem Währungssymbol Valuta Símbolo de moneda Currency Symbol Symbole Monétaire 貨幣符號 Символ валюты สัญลักษณ์ค่าเงิน Para Birimi Simbol Mata Uang Simbolo moeda Valutna oznaka
42 config_currency_decimals Currency Decimals Currency Decimals Currency Decimals Decimales de moneda Currency Decimals Currency Decimals Currency Decimals Currency Decimals Currency Decimals Currency Decimals Currency Decimals Decimais moeda Velutne decimale
43 config_custom1 Egyedi mező 1 Zusatzfeld 1 Custom Veld 1 Campo Libre 1 Custom Field 1 Champ Personnalisé 1 Custom Field 1 Изготовленный пробел 1 พื้นที่เพิ่มเติม 1 Özel Alan 1 Custom Field 1 Campo customizado 1 Korisničko polje1
171 config_timezone Időzóna Zeitzone Tijdzone Zona Horaria Timezone Fuseau Horaire 時區 Часовой пояс โซนเวลา Saat Dilimi Zona Waktu Fuso horário Vremenska zona
172 config_top Top Top Top Top Top Top Top Top Top Top Top Topo Top
173 config_website Weboldal Website Website Sitio Web Website Site-web 網站 Веб-сайт เว็บไซต์ Website Situs Perusahaan Site da internet web strana
174 config_number_locale Lokalizációs Länderkonfiguration Localisation Ubicación Localisation Localisation Localisation Localisation Localisation Localisation Localisation Localização Lokalnoj
175 config_return_policy_required Return policy is a required field Rücknahmepolitik erforderlich De retourvoorwaarden moeten ingevuld worden Política de Devolución es requerida Return policy is a required field Le Message est un champ requis 退換貨政策為必填 Возвратний полис обязательный пробел ต้องกรอกเงื่อนไขการคืนสินค้า İade Politikası zorunlu alandır Kebijakan retur wajib diisi A política de devolução é um campo obrigatório Polje za povratne obavijesti je potrebno
176 config_number_locale_required Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field Number Locale is a required field
177 config_number_locale_invalid The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value The entered locale is invalid. Check the link in the tooltip to find a sensible value
178 config_number_locale_tooltip Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link Find a suitable locale through this link