diff --git a/application/controllers/Receivings.php b/application/controllers/Receivings.php index 75b9c0cfe..102dda55f 100644 --- a/application/controllers/Receivings.php +++ b/application/controllers/Receivings.php @@ -99,11 +99,6 @@ class Receivings extends Secure_Controller $this->_reload($data); } - function numeric($str) - { - return parse_decimals($str, 3); - } - public function edit_item($item_id) { $data = array(); diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index db1fb73c9..3a538aec4 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -285,11 +285,6 @@ class Sales extends Secure_Controller $this->_reload($data); } - function numeric($str) - { - return parse_decimals($str, 3); - } - public function edit_item($item_id) { $data = array(); diff --git a/application/controllers/Secure_Controller.php b/application/controllers/Secure_Controller.php index 2b59bd663..8d4c78534 100644 --- a/application/controllers/Secure_Controller.php +++ b/application/controllers/Secure_Controller.php @@ -50,7 +50,21 @@ class Secure_Controller extends CI_Controller return $this->security->xss_clean($str, $is_image); } } - + + function numeric($str) + { + return parse_decimals($str); + } + + public function check_numeric() + { + $result = TRUE; + foreach($this->input->get() as $str) { + $result = parse_decimals($str); + } + echo $result !== FALSE ? 'true' : 'false'; + } + // this is the basic set of methods most OSPOS Controllers will implement public function index() { return FALSE; } public function search() { return FALSE; } diff --git a/application/helpers/locale_helper.php b/application/helpers/locale_helper.php index c7d73cd6f..23519c72e 100644 --- a/application/helpers/locale_helper.php +++ b/application/helpers/locale_helper.php @@ -82,6 +82,10 @@ function parse_decimals($number) $config = get_instance()->config; $fmt = new \NumberFormatter( $config->item('number_locale'), \NumberFormatter::DECIMAL ); + if (empty($config->item('thousands_separator'))) + { + $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); + } return $fmt->parse($number); } diff --git a/application/views/configs/general_config.php b/application/views/configs/general_config.php index 16dd357ed..385367b6b 100644 --- a/application/views/configs/general_config.php +++ b/application/views/configs/general_config.php @@ -264,18 +264,22 @@ $(document).ready(function() default_tax_1_rate: { required: true, - number: true + remote: "" }, default_tax_1_name: "required", + default_tax2_rate: + { + remote: "" + }, lines_per_page: { required: true, - number: true + remote: "" }, default_sales_discount: { required: true, - number: true + remote: "" } }, diff --git a/application/views/items/form.php b/application/views/items/form.php index b5b0d27c7..d2fd78b12 100644 --- a/application/views/items/form.php +++ b/application/views/items/form.php @@ -376,13 +376,13 @@ }, cost_price: { - required:true, - number:true + required: true, + remote: "" }, unit_price: { required:true, - number:true + remote: "" }, $location_detail) @@ -391,7 +391,7 @@ : { required:true, - number:true + remote: "" }, " }, reorder_level: { required:true, - number:true + remote: "" }, tax_percent: { required:true, - number:true + remote: "" } },