Skip to content

Firefly III: a personal finances manager

Add search support for SEPA CT

Janne Heßdcfcbfd9b5e3
diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php
index dadb4067f7..99bb44d16a 100644
--- a/app/Helpers/Collector/Extensions/MetaCollection.php
+++ b/app/Helpers/Collector/Extensions/MetaCollection.php
@@ -699,4 +699,17 @@ trait MetaCollection
return $this;
}
+
+ /**
+ * @inheritDoc
+ */
+ public function setSepaCT(string $sepaCT): GroupCollectorInterface
+ {
+ $this->joinMetaDataTables();
+ $this->query->where('journal_meta.name', '=', 'sepa_ct_id');
+ $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($sepaCT)));
+ $this->query->whereNull('journal_meta.deleted_at');
+
+ return $this;
+ }
}
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 2004c46515..3978c9caec 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -863,6 +863,9 @@ class OperatorQuerySearch implements SearchInterface
case 'attachment_notes_ends':
$this->collector->attachmentNotesEnds($value);
break;
+ case 'sepa_ct_is':
+ $this->collector->setSepaCT($value);
+ break;
}
diff --git a/config/search.php b/config/search.php
index a81cd55eaa..45c9a8991c 100644
--- a/config/search.php
+++ b/config/search.php
@@ -229,5 +229,6 @@ return [
'attachment_notes_start' => ['alias' => true, 'alias_for' => 'attachment_notes_starts', 'needs_context' => true],
'attachment_notes_ends' => ['alias' => false, 'needs_context' => true],
'attachment_notes_end' => ['alias' => true, 'alias_for' => 'attachment_notes_ends', 'needs_context' => true],
+ 'sepa_ct_is' => ['alias' => false, 'needs_context' => true],
],
];
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 556974be70..2d051bcffa 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -501,6 +501,7 @@ return [
'search_modifier_attachment_notes_contains' => 'Any attachment\'s notes contain ":value"',
'search_modifier_attachment_notes_starts' => 'Any attachment\'s notes start with ":value"',
'search_modifier_attachment_notes_ends' => 'Any attachment\'s notes end is ":value"',
+ 'search_modifier_sepa_ct_is' => 'SEPA CT is ":value"',
'update_rule_from_query' => 'Update rule ":rule" from search query',
'create_rule_from_query' => 'Create new rule from search query',
'rule_from_search_words' => 'The rule engine has a hard time handling ":string". The suggested rule that fits your search query may give different results. Please verify the rule triggers carefully.',
@@ -723,6 +724,8 @@ return [
'rule_trigger_no_external_url_choice' => 'Transaction has no external URL',
'rule_trigger_id_choice' => 'Transaction ID is..',
'rule_trigger_id' => 'Transaction ID is ":trigger_value"',
+ 'rule_trigger_sepa_ct_is_choice' => 'SEPA CT is..',
+ 'rule_trigger_sepa_ct_is' => 'SEPA CT is ":trigger_value"',
// new values:
'rule_trigger_user_action_choice' => 'User action is ":trigger_value"',