From 5af0219884dd5e1d06c7c620bd06bfa03f16039a Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 31 Jul 2024 20:31:52 +0200 Subject: [PATCH] Fix https://github.com/firefly-iii/firefly-iii/issues/9103 --- .../UserGroups/Currency/CurrencyRepository.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index 5f66f4dd0d..147829355a 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -84,6 +84,14 @@ class CurrencyRepository implements CurrencyRepositoryInterface return 'account_meta'; } + // second search using integer check. + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int)$currency->id))->count(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + // is being used in bills: $bills = Bill::where('transaction_currency_id', $currency->id)->count(); if ($bills > 0) {