This commit is contained in:
James Cole
2019-12-28 06:38:23 +01:00
parent 0d48556994
commit 47eb39b10d
2 changed files with 6 additions and 3 deletions

View File

@@ -48,6 +48,8 @@ class RuleEngine
public const TRIGGER_STORE = 1;
/** @var int */
public const TRIGGER_UPDATE = 2;
/** @var int */
public const TRIGGER_BOTH = 3;
/** @var bool */
private $allRules;
/** @var RuleGroupRepository */
@@ -227,7 +229,8 @@ class RuleEngine
}
$validTrigger = ('store-journal' === $trigger->trigger_value && self::TRIGGER_STORE === $this->triggerMode)
|| ('update-journal' === $trigger->trigger_value && self::TRIGGER_UPDATE === $this->triggerMode);
|| ('update-journal' === $trigger->trigger_value && self::TRIGGER_UPDATE === $this->triggerMode)
|| $this->triggerMode === self::TRIGGER_BOTH;
return $validTrigger && ($this->allRules || in_array($rule->id, $this->rulesToApply, true)) && true === $rule->active;
}