Account search fixed.

This commit is contained in:
James Cole
2020-08-28 11:24:55 +02:00
parent 63794cab07
commit 093f34b7a8
26 changed files with 157 additions and 996 deletions

View File

@@ -47,35 +47,6 @@ class SetCategory implements ActionInterface
$this->action = $action;
}
/**
* Set category X
*
* @param TransactionJournal $journal
* @deprecated
* @codeCoverageIgnore
* @return bool
*/
public function act(TransactionJournal $journal): bool
{
$name = $this->action->action_value;
/** @var CategoryFactory $factory */
$factory = app(CategoryFactory::class);
$factory->setUser($journal->user);
$category = $factory->findOrCreate(null, $name);
if (null === $category) {
Log::error(sprintf('Action SetCategory did not fire because "%s" did not result in a valid category.', $name));
return false;
}
$journal->categories()->sync([$category->id]);
Log::debug(sprintf('RuleAction SetCategory set the category of journal #%d to category #%d ("%s").', $journal->id, $category->id, $category->name));
return true;
}
/**
* @inheritDoc
*/