Add rule error reporting to all rules.

This commit is contained in:
James Cole
2023-08-13 15:01:12 +02:00
parent 965acd6d45
commit b0ab06b7eb
19 changed files with 199 additions and 66 deletions

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\TransactionRules\Actions;
use DB;
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
use FireflyIII\Events\TriggeredAuditLog;
use FireflyIII\Factory\CategoryFactory;
use FireflyIII\Models\RuleAction;
@@ -57,7 +58,7 @@ class SetCategory implements ActionInterface
$search = $this->action->action_value;
if (null === $user) {
Log::error(sprintf('Journal has no valid user ID so action SetCategory("%s") cannot be applied', $search), $journal);
// TODO introduce error
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
return false;
}
@@ -73,7 +74,7 @@ class SetCategory implements ActionInterface
$search
)
);
// TODO introduce error
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_category', ['name' => $search])));
return false;
}