mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 02:57:45 +00:00
Expand rules and bills.
This commit is contained in:
@@ -49,6 +49,8 @@ final class Processor
|
||||
public $triggers;
|
||||
/** @var int Found triggers */
|
||||
private $foundTriggers = 0;
|
||||
/** @var bool */
|
||||
private $strict = true;
|
||||
|
||||
/**
|
||||
* Processor constructor.
|
||||
@@ -72,9 +74,11 @@ final class Processor
|
||||
public static function make(Rule $rule, $includeActions = true)
|
||||
{
|
||||
Log::debug(sprintf('Making new rule from Rule %d', $rule->id));
|
||||
$self = new self;
|
||||
$self->rule = $rule;
|
||||
$triggerSet = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
|
||||
Log::debug(sprintf('Rule is strict: %s', var_export($rule->strict, true)));
|
||||
$self = new self;
|
||||
$self->rule = $rule;
|
||||
$self->strict = $rule->strict;
|
||||
$triggerSet = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
|
||||
/** @var RuleTrigger $trigger */
|
||||
foreach ($triggerSet as $trigger) {
|
||||
Log::debug(sprintf('Push trigger %d', $trigger->id));
|
||||
@@ -274,6 +278,12 @@ final class Processor
|
||||
if ($trigger->triggered($this->journal)) {
|
||||
Log::debug('Is a match!');
|
||||
++$hitTriggers;
|
||||
// is non-strict? then return true!
|
||||
if (!$this->strict) {
|
||||
Log::debug('Rule is set as non-strict, return true!');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($trigger->stopProcessing) {
|
||||
Log::debug('Stop processing this trigger and break.');
|
||||
|
Reference in New Issue
Block a user