Make sure limits exist in rule engine.

This commit is contained in:
James Cole 2020-08-23 17:00:47 +02:00
parent 41f2339c8c
commit 28698cc769
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -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));