From c563340532b9738b09a2d8f06f289ec85966083e Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 1 Dec 2020 12:24:23 +0100 Subject: [PATCH] Fix comma parsing when users search for amount:12,34 --- app/Support/Search/OperatorQuerySearch.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index a3b3fcf5d2..5a465b846d 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -498,17 +498,27 @@ class OperatorQuerySearch implements SearchInterface // amount // case 'amount_exactly': - $amount = app('steam')->positive((string)$value); + + // strip comma's, make dots. + $value = str_replace(',', '.', (string)$value); + + $amount = app('steam')->positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountIs($amount); break; case 'amount_less': - $amount = app('steam')->positive((string)$value); + // strip comma's, make dots. + $value = str_replace(',', '.', (string)$value); + + $amount = app('steam')->positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountLess($amount); break; case 'amount_more': - $amount = app('steam')->positive((string)$value); + // strip comma's, make dots. + $value = str_replace(',', '.', (string)$value); + + $amount = app('steam')->positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountMore($amount); break;