Skip to content

Firefly III: a personal finances manager

Add missing method.

James Colec9fefcd8f4f5
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
index 99c8763d6a..a421b9c760 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php
@@ -239,6 +239,14 @@ class CurrencyRepository implements CurrencyRepositoryInterface
$currency->save();
}
+ /**
+ * @inheritDoc
+ */
+ public function findByName(string $name): ?TransactionCurrency
+ {
+ return TransactionCurrency::where('name', $name)->first();
+ }
+
/**
* Find by object, ID or code. Returns user default or system default.
*
diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
index d81a11752c..1ba5fe9667 100644
--- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
+++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php
@@ -84,6 +84,13 @@ interface CurrencyRepositoryInterface
*/
public function findByCode(string $currencyCode): ?TransactionCurrency;
+ /**
+ * @param string $name
+ *
+ * @return TransactionCurrency|null
+ */
+ public function findByName(string $name): ?TransactionCurrency;
+
/**
* Find by object, ID or code. Returns user default or system default.
*
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index ff1ff1c568..470067caea 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -1536,9 +1536,9 @@ class OperatorQuerySearch implements SearchInterface
$parts = explode(' ', $value);
$value = trim($parts[count($parts) - 1], "() \t\n\r\0\x0B");
}
- $result = $this->currencyRepository->findByCodeNull($value);
+ $result = $this->currencyRepository->findByCode($value);
if (null === $result) {
- $result = $this->currencyRepository->findByNameNull($value);
+ $result = $this->currencyRepository->findByName($value);
}
return $result;