From c9fefcd8f4f5c70ce161ed22b66250091de141a6 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 28 Oct 2023 18:08:43 +0200 Subject: [PATCH 1/2] Add missing method. --- .../UserGroups/Currency/CurrencyRepository.php | 8 ++++++++ .../UserGroups/Currency/CurrencyRepositoryInterface.php | 7 +++++++ app/Support/Search/OperatorQuerySearch.php | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) 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; From 6f13600fb58c1086f0b2c2e523562295bb6b94f2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 28 Oct 2023 18:18:12 +0200 Subject: [PATCH 2/2] Add missing method. --- app/Http/Controllers/NewUserController.php | 2 +- app/Repositories/Budget/BudgetRepository.php | 2 +- changelog.md | 6 ++++++ config/firefly.php | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 3a2d8e8680..de2beda01a 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -104,7 +104,7 @@ class NewUserController extends Controller // if is null, set to EUR: if (null === $currency) { - $currency = $currencyRepository->findByCodeNull('EUR'); + $currency = $currencyRepository->findByCode('EUR'); } $currencyRepository->enable($currency); diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index ad98dae7cc..069a204e4d 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -435,7 +435,7 @@ class BudgetRepository implements BudgetRepositoryInterface $currencyCode = (string)($data['currency_code'] ?? ''); $currency = $repos->find($currencyId); if (null === $currency) { - $currency = $repos->findByCodeNull($currencyCode); + $currency = $repos->findByCode($currencyCode); } if (null !== $currency) { $autoBudget->transaction_currency_id = $currency->id; diff --git a/changelog.md b/changelog.md index 5719df164e..f93a900746 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 6.0.30 - 2023-10-29 + +### Fixed + +- Missing method after refactoring. + ## 6.0.29 - 2023-10-29 ### Fixed diff --git a/config/firefly.php b/config/firefly.php index 497467cff1..26ba1bd4d3 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -112,7 +112,7 @@ return [ 'handle_debts' => true, // see cer.php for exchange rates feature flag. ], - 'version' => '6.0.29', + 'version' => '6.0.30', 'api_version' => '2.0.11', 'db_version' => 21,