diff --git a/.travis.yml b/.travis.yml index cc319fe1f..3deed8f97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,5 @@ script: - docker-compose up -d after_success: - - > - '[ -n ${DOCKER_USERNAME} ] && - docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && - docker tag opensourcepos_php_1 jekkos/opensourcepos:$TRAVIS_BRANCH && - docker tag opensourcepos_sqlscript_1 jekkos/opensourcepos:sqlscript && - docker push jekkos/opensourcepos:master && docker push jekkos/opensourcepos:sqlscript' + - '[ -n ${DOCKER_USERNAME} ] && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker tag opensourcepos_php jekkos/opensourcepos:${TRAVIS_BRANCH} && docker tag opensourcepos_sqlscript jekkos/opensourcepos:sqlscript && docker push jekkos/opensourcepos:master && docker push jekkos/opensourcepos:sqlscript' diff --git a/README.md b/README.md index 432bae4e3..69b240cc1 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,6 @@ FAQ --- * If a blank page (HTTP status 500) shows after search completion or receipt generation, then double check php5-gd presence in your php installation. On windows check in php.ini whether the lib is installed. On Ubuntu issue `sudo apt-get install php5-gd`. Also have a look at the Dockerfile for a complete list of recommended packages. -* If following error is sene in sales module `Message: Class 'NumberFormatter' not found` then you don't have `php5-intl` extension installed. Please check the [wiki](https://github.com/jekkos/opensourcepos/wiki/Localisation-support#php5-intl-extension-installation) to resolve this issue on your platform. +* If the following error is seen in sales module `Message: Class 'NumberFormatter' not found` then you don't have `php5-intl` extension installed. Please check the [wiki](https://github.com/jekkos/opensourcepos/wiki/Localisation-support#php5-intl-extension-installation) to resolve this issue on your platform. ca diff --git a/application/controllers/Config.php b/application/controllers/Config.php index 3a0c480bf..3049bea2f 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -142,9 +142,18 @@ 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'); + if ($this->input->post('thousands_separator') == "false") + { + $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_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)); + echo json_encode(array( + 'success' => $number_local_example != FALSE, + 'number_locale_example' => $number_local_example, + 'currency_symbol' => $currency_symbol, + 'thousands_separator' => $fmt->getAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL) != '' + )); } public function save_locale() @@ -155,7 +164,8 @@ class Config extends Secure_Controller 'timezone' => $this->input->post('timezone'), 'dateformat' => $this->input->post('dateformat'), 'timeformat' => $this->input->post('timeformat'), - 'number_locale' => $this->input->post('number_locale'), + 'thousands_separator' => $this->input->post('thousands_separator'), + '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'), diff --git a/application/controllers/Receivings.php b/application/controllers/Receivings.php index c24935ab3..75b9c0cfe 100644 --- a/application/controllers/Receivings.php +++ b/application/controllers/Receivings.php @@ -101,7 +101,7 @@ class Receivings extends Secure_Controller function numeric($str) { - return parse_decimals($str, 2); + return parse_decimals($str, 3); } public function edit_item($item_id) diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index 355aed2d2..0046051b3 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -224,7 +224,7 @@ class Sales extends Secure_Controller } else { - $amount_tendered = parse_decimals($this->input->post('amount_tendered')); + $amount_tendered = $this->input->post('amount_tendered'); $this->sale_lib->add_payment($payment_type, $amount_tendered); } @@ -286,7 +286,7 @@ class Sales extends Secure_Controller function numeric($str) { - return parse_decimals($str, 2); + return parse_decimals($str, 3); } public function edit_item($item_id) diff --git a/application/helpers/locale_helper.php b/application/helpers/locale_helper.php index 06dadbd8d..d39a4fb0a 100644 --- a/application/helpers/locale_helper.php +++ b/application/helpers/locale_helper.php @@ -64,6 +64,10 @@ function to_decimals($number, $decimals, $type=\NumberFormatter::DECIMAL) $fmt = new \NumberFormatter($config->item('number_locale'), $type); $fmt->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, $config->item($decimals)); $fmt->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, $config->item($decimals)); + if (empty($config->item('thousands_separator'))) + { + $fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, ''); + } $fmt->setSymbol(\NumberFormatter::CURRENCY_SYMBOL, $config->item('currency_symbol')); return $fmt->format($number); } diff --git a/application/views/configs/locale_config.php b/application/views/configs/locale_config.php index 6fc5697ff..796c8077e 100644 --- a/application/views/configs/locale_config.php +++ b/application/views/configs/locale_config.php @@ -4,17 +4,6 @@