Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix https://github.com/orgs/firefly-iii/discussions/12583
Sander Dorigo833432025faa
diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.phpindex ecaf44c986..a420ed7ca9 100644--- a/app/Helpers/Collector/Extensions/AmountCollection.php+++ b/app/Helpers/Collector/Extensions/AmountCollection.php@@ -104,6 +104,24 @@ trait AmountCollectionreturn $this;}+ public function hasForeignCurrencyId(): GroupCollectorInterface+ {+ $this->query->where(static function (EloquentBuilder $q): void {+ $q->whereNotNull('source.foreign_currency_id');+ });++ return $this;+ }++ public function hasNoForeignCurrencyId(): GroupCollectorInterface+ {+ $this->query->where(static function (EloquentBuilder $q): void {+ $q->whereNull('source.foreign_currency_id');+ });++ return $this;+ }+/*** Get transactions where the amount is less than.*/diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.phpindex c8f0d8cde7..be83a19dd9 100644--- a/app/Helpers/Collector/GroupCollectorInterface.php+++ b/app/Helpers/Collector/GroupCollectorInterface.php@@ -182,6 +182,9 @@ interface GroupCollectorInterface*/public function excludeForeignCurrency(TransactionCurrency $currency): self;+ public function hasForeignCurrencyId(): self;+ public function hasNoForeignCurrencyId(): self;+/*** Limit the result to NOT a set of specific transaction groups.*/diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.phpindex 78ec7afef7..f444510f09 100644--- a/app/Support/Search/OperatorQuerySearch.php+++ b/app/Support/Search/OperatorQuerySearch.php@@ -2397,7 +2397,12 @@ class OperatorQuerySearch implements SearchInterface$this->collector->foreignAmountIsNot($amount);break;-+ case 'has_foreign_amount':+ $this->collector->hasForeignCurrencyId();+ break;+ case '-has_foreign_amount':+ $this->collector->hasNoForeignCurrencyId();+ break;case '-amount_more':case 'amount_less':// strip comma's, make dots.diff --git a/config/search.php b/config/search.phpindex 05bd7eb0f1..6374b2cd86 100644--- a/config/search.php+++ b/config/search.php@@ -154,6 +154,7 @@ return ['account_is_cash' => ['alias' => false, 'needs_context' => false],'currency_is' => ['alias' => false, 'needs_context' => true],'foreign_currency_is' => ['alias' => false, 'needs_context' => true],+ 'has_foreign_amount' => ['alias' => false, 'needs_context' => false],'id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true],'journal_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true],'recurrence_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true],