diff --git a/app/Console/Commands/Tools/ApplyRules.php b/app/Console/Commands/Tools/ApplyRules.php index 27670e4ec3..3e5e2e7078 100644 --- a/app/Console/Commands/Tools/ApplyRules.php +++ b/app/Console/Commands/Tools/ApplyRules.php @@ -130,6 +130,18 @@ class ApplyRules extends Command $ruleEngine->setRules($rulesToApply); $ruleEngine->setUser($this->getUser()); + // add the accounts as filter: + $accounts = []; + foreach($this->accounts as $account) { + $accounts[] = $account->id; + } + $list = implode(',', $accounts); + $ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]); + + // add the date as a filter: + $ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->startDate->format('Y-m-d')]); + $ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]); + // start running rules. $this->line(sprintf('Will apply %d rule(s) to your transaction(s).', $count));