mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Account search fixed.
This commit is contained in:
@@ -46,46 +46,6 @@ class SetBudget implements ActionInterface
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set budget.
|
||||
*
|
||||
* @param TransactionJournal $journal
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
* @return bool
|
||||
*/
|
||||
public function act(TransactionJournal $journal): bool
|
||||
{
|
||||
$search = $this->action->action_value;
|
||||
|
||||
$budget = $journal->user->budgets()->where('name', $search)->first();
|
||||
if (null === $budget) {
|
||||
Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal->id, $search));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TransactionType::WITHDRAWAL !== $journal->transactionType->type) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.',
|
||||
$journal->id,
|
||||
$search,
|
||||
$journal->transactionType->type
|
||||
)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal->id, $budget->id, $budget->name));
|
||||
|
||||
$journal->budgets()->sync([$budget->id]);
|
||||
$journal->touch();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
Reference in New Issue
Block a user