diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php
index 8f7ddaac4e..3f78585b94 100644
--- a/app/Console/Commands/Tools/ApplyRules.php
+++ b/app/Console/Commands/Tools/ApplyRules.php
@@ -133,7 +133,7 @@ class ApplyRules extends Command
// start running rules.
$this->friendlyLine(sprintf('Will apply %d rule(s) to your transaction(s).', $count));
- // file the rule(s)
+ // fire the rule(s)
$ruleEngine->fire();
$this->friendlyLine('');
diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php
index edfb5e5776..fcd0383c93 100644
--- a/app/TransactionRules/Engine/SearchRuleEngine.php
+++ b/app/TransactionRules/Engine/SearchRuleEngine.php
@@ -100,8 +100,16 @@ class SearchRuleEngine implements RuleEngineInterface
// if rules and no rule groups, file each rule separately.
if (0 !== $this->rules->count()) {
app('log')->debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count()));
+
+ /** @var Rule $rule */
foreach ($this->rules as $rule) {
- $this->fireRule($rule);
+ $result = $this->fireRule($rule);
+ if (true === $result && $rule->stop_processing) {
+ app('log')->debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id));
+ }
+ if (false === $result && $rule->stop_processing) {
+ app('log')->debug(sprintf('Rule #%d has triggered and changed nothing, but calls to stop processing. Do not stop.', $rule->id));
+ }
}
app('log')->debug('SearchRuleEngine:: done processing all rules!');
@@ -176,7 +184,7 @@ class SearchRuleEngine implements RuleEngineInterface
}
// if needs no context, value is different:
- $needsContext = (bool)(config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true);
+ $needsContext = (bool) (config(sprintf('search.operators.%s.needs_context', $ruleTrigger->trigger_type)) ?? true);
if (false === $needsContext) {
app('log')->debug(sprintf('SearchRuleEngine:: add a rule trigger (no context): %s:true', $ruleTrigger->trigger_type));
$searchArray[$ruleTrigger->trigger_type][] = 'true';
@@ -249,7 +257,7 @@ class SearchRuleEngine implements RuleEngineInterface
$journalId = 0;
foreach ($array as $triggerName => $values) {
if ('journal_id' === $triggerName && is_array($values) && 1 === count($values)) {
- $journalId = (int)trim($values[0] ?? '"0"', '"'); // follows format "123".
+ $journalId = (int) trim($values[0] ?? '"0"', '"'); // follows format "123".
app('log')->debug(sprintf('Found journal ID #%d', $journalId));
}
}
@@ -326,7 +334,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
++$count;
// if trigger says stop processing, do so.
- if($ruleTrigger->stop_processing && $collection->count() > 0) {
+ if ($ruleTrigger->stop_processing && $collection->count() > 0) {
app('log')->debug('The trigger says to stop processing, so stop processing other triggers.');
break;
diff --git a/public/v1/js/ff/rules/index.js b/public/v1/js/ff/rules/index.js
index cae9c524bc..be61c0853d 100644
--- a/public/v1/js/ff/rules/index.js
+++ b/public/v1/js/ff/rules/index.js
@@ -97,6 +97,35 @@ $(function () {
}
);
+ // show rule triggers
+ $('.rule-triggers-show').click(function (e) {
+ var obj = $(e.currentTarget);
+ $('.rule-trigger-list[data-id="' + obj.data('id') + '"]').show();
+ $('.rule-triggers-show[data-id="' + obj.data('id') + '"]').hide();
+ });
+
+ $('.rule-trigger-list').each(function(i,v) {
+ var obj = $(v);
+ if(obj.data('count') > 2) {
+ obj.hide();
+ $('.rule-triggers-show[data-id="' + obj.data('id') + '"]').show();
+ }
+ });
+ // show rule actions
+ $('.rule-actions-show').click(function (e) {
+ var obj = $(e.currentTarget);
+ $('.rule-action-list[data-id="' + obj.data('id') + '"]').show();
+ $('.rule-actions-show[data-id="' + obj.data('id') + '"]').hide();
+ });
+
+ $('.rule-action-list').each(function(i,v) {
+ var obj = $(v);
+ if(obj.data('count') > 1) {
+ obj.hide();
+ $('.rule-actions-show[data-id="' + obj.data('id') + '"]').show();
+ }
+ });
+
$('.move-group').click(moveRuleGroup);
$('.duplicate-rule').click(duplicateRule);
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index afbc6480d4..a778c3cd0b 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -721,6 +721,8 @@ return [
// rules
'is_not_rule_trigger' => 'Not',
'cannot_fire_inactive_rules' => 'You cannot execute inactive rules.',
+ 'show_triggers' => 'Show triggers',
+ 'show_actions' => 'Show actions',
'rules' => 'Rules',
'rule_name' => 'Name of rule',
'rule_triggers' => 'Rule triggers when',
diff --git a/resources/views/rules/index.twig b/resources/views/rules/index.twig
index 45c50c328f..ebf96c07df 100644
--- a/resources/views/rules/index.twig
+++ b/resources/views/rules/index.twig
@@ -125,11 +125,11 @@
{% endif %}
>
{{ rule.description|default('')|markdown }}
{% endif %}
-
{% if rule.strict %}{{ 'rule_is_strict'|_ }}{% else %}{{ 'rule_is_not_strict'|_ }}{% endif %}
+ ({% if rule.strict %}{{ 'rule_is_strict'|_ }}{% else %}{{ 'rule_is_not_strict'|_ }}{% endif %})