Revert Giftcard broken fix (#1694)

This commit is contained in:
FrancescoUK committed 2018-03-16 19:18:37 +00:00
1 parent ddb0e7560c
commit 63d9fd219c
2 files changed
+7 -9

No files matched your search

+2 -7
View File
@@ -130,13 +130,8 @@ class Giftcards extends Secure_Controller
public function ajax_check_number_giftcard()
{
$value = $this->input->post('giftcard_amount');
$parsed_value = parse_decimals($value);
if(strcmp(strval($parsed_value), strval($value)) != 0)
{
$parsed_value = FALSE;
}
echo json_encode(array('success' => !empty($parsed_value), 'giftcard_amount' => $parsed_value));
$parsed_value = parse_decimals($this->input->post('giftcard_amount'));
echo json_encode(array('success' => $parsed_value !== FALSE, 'giftcard_amount' => $parsed_value));
}
public function delete()
+5 -2
View File
@@ -308,7 +308,10 @@ function parse_decimals($number)
}
$config = get_instance()->config;
$fmt = new \NumberFormatter( $config->item('number_locale'), \NumberFormatter::DECIMAL );
$fmt = new \NumberFormatter($config->item('number_locale'), \NumberFormatter::DECIMAL);
$fmt->setAttribute(\NumberFormatter::FRACTION_DIGITS, $config->item('currency_decimals'));
if (empty($config->item('thousands_separator')))
{
$fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
@@ -318,7 +321,7 @@ function parse_decimals($number)
{
return $fmt->parse($number);
}
catch (Exception $e)
catch(Exception $e)
{
return FALSE;
}