From ed17600f794805cc5debc6055cca28eac4996699 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 28 Aug 2020 06:09:04 +0200 Subject: [PATCH] Fix currency search. --- app/Support/Search/OperatorQuerySearch.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index f428e9722d..f2ebfa8ed7 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -677,6 +677,13 @@ class OperatorQuerySearch implements SearchInterface */ private function findCurrency(string $value): ?TransactionCurrency { + if(str_contains($value,'(') && str_contains($value,')')) { + // bad method to split and get the currency code: + $parts = explode(' ', $value); + $value = trim($parts[count($parts) -1], "() \t\n\r\0\x0B"); + } + + $result = $this->currencyRepository->findByCodeNull($value); if (null === $result) { $result = $this->currencyRepository->findByNameNull($value);