diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index c726c945d3..ff263d200a 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -269,6 +269,19 @@ trait MetaCollection return $this; } + /** + * Limit results to transactions without a bill.. + * + * @return GroupCollectorInterface + */ + public function withBill(): GroupCollectorInterface + { + $this->withBillInformation(); + $this->query->whereNotNull('transaction_journals.bill_id'); + + return $this; + } + /** * Will include bill name + ID, if any. * diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.php index 964ad19aa0..64354d5f6d 100644 --- a/app/Helpers/Collector/GroupCollectorInterface.php +++ b/app/Helpers/Collector/GroupCollectorInterface.php @@ -520,6 +520,13 @@ interface GroupCollectorInterface */ public function withTagInformation(): GroupCollectorInterface; + /** + * Limit results to transactions without a bill.. + * + * @return GroupCollectorInterface + */ + public function withBill(): GroupCollectorInterface; + /** * Limit results to a transactions without a bill. * diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index b0792b2740..65ce6e8cad 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -476,6 +476,12 @@ class OperatorQuerySearch implements SearchInterface // // bill // + case 'has_no_bill': + $this->collector->withoutBill(); + break; + case 'has_any_bill': + $this->collector->withBill(); + break; case 'bill_is': $result = $this->billRepository->searchBill($value, 25); if ($result->count() > 0) { diff --git a/config/firefly.php b/config/firefly.php index 01bb9c3ed6..32cc747201 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -476,6 +476,8 @@ return [ 'has_any_category' => ['alias' => false, 'needs_context' => false,], 'has_no_budget' => ['alias' => false, 'needs_context' => false,], 'has_any_budget' => ['alias' => false, 'needs_context' => false,], + 'has_no_bill' => ['alias' => false, 'needs_context' => false,], + 'has_any_bill' => ['alias' => false, 'needs_context' => false,], 'has_no_tag' => ['alias' => false, 'needs_context' => false,], 'has_any_tag' => ['alias' => false, 'needs_context' => false,], 'notes_contain' => ['alias' => false, 'needs_context' => true,], diff --git a/public/v1/js/ff/rules/create-edit.js b/public/v1/js/ff/rules/create-edit.js index 9ebf36bbad..4fe73c78c4 100644 --- a/public/v1/js/ff/rules/create-edit.js +++ b/public/v1/js/ff/rules/create-edit.js @@ -338,6 +338,8 @@ function updateTriggerInput(selectList) { case 'has_any_category': case 'has_no_budget': case 'has_any_budget': + case 'has_no_bill': + case 'has_any_bill': case 'has_no_tag': case 'no_notes': case 'any_notes': diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index ba9bf9e640..baa1ca8c6e 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -298,6 +298,8 @@ return [ 'search_modifier_has_any_category' => 'The transaction must have a (any) category', 'search_modifier_has_no_budget' => 'The transaction must have no budget', 'search_modifier_has_any_budget' => 'The transaction must have a (any) budget', + 'search_modifier_has_no_bill' => 'The transaction must have no bill', + 'search_modifier_has_any_bill' => 'The transaction must have a (any) bill', 'search_modifier_has_no_tag' => 'The transaction must have no tags', 'search_modifier_has_any_tag' => 'The transaction must have a (any) tag', 'search_modifier_notes_contain' => 'The transaction notes contain ":value"', @@ -525,6 +527,10 @@ return [ 'rule_trigger_has_no_budget' => 'Transaction has no budget', 'rule_trigger_has_any_budget_choice' => 'Has a (any) budget', 'rule_trigger_has_any_budget' => 'Transaction has a (any) budget', + 'rule_trigger_has_no_bill_choice' => 'Has no bill', + 'rule_trigger_has_no_bill' => 'Transaction has no bill', + 'rule_trigger_has_any_bill_choice' => 'Has a (any) bill', + 'rule_trigger_has_any_bill' => 'Transaction has a (any) bill', 'rule_trigger_has_no_tag_choice' => 'Has no tag(s)', 'rule_trigger_has_no_tag' => 'Transaction has no tag(s)', 'rule_trigger_has_any_tag_choice' => 'Has one or more (any) tags',