Fix currency search.

This commit is contained in:
James Cole 2020-08-28 06:09:04 +02:00
parent 778af9f4e2
commit ed17600f79
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -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);