mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\TransactionRules\Actions;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
|
||||
use FireflyIII\Events\TriggeredAuditLog;
|
||||
@@ -54,14 +55,14 @@ class SetSourceToCashAccount implements ActionInterface
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
if (null === $object) {
|
||||
app('log')->error('Could not find journal.');
|
||||
Log::error('Could not find journal.');
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_such_journal')));
|
||||
|
||||
return false;
|
||||
}
|
||||
$type = $object->transactionType->type;
|
||||
if (TransactionTypeEnum::DEPOSIT->value !== $type) {
|
||||
app('log')->error('Transaction must be deposit.');
|
||||
Log::error('Transaction must be deposit.');
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.not_deposit')));
|
||||
|
||||
return false;
|
||||
@@ -75,20 +76,20 @@ class SetSourceToCashAccount implements ActionInterface
|
||||
/** @var null|Transaction $destination */
|
||||
$destination = $object->transactions()->where('amount', '>', 0)->first();
|
||||
if (null === $destination) {
|
||||
app('log')->error('Could not find destination transaction.');
|
||||
Log::error('Could not find destination transaction.');
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_destination_transaction')));
|
||||
|
||||
return false;
|
||||
}
|
||||
// account must not be deleted (in the meantime):
|
||||
if (null === $destination->account) {
|
||||
app('log')->error('Could not find destination transaction account.');
|
||||
Log::error('Could not find destination transaction account.');
|
||||
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.cannot_find_destination_transaction_account')));
|
||||
|
||||
return false;
|
||||
}
|
||||
if ($cashAccount->id === $destination->account_id) {
|
||||
app('log')->error(
|
||||
Log::error(
|
||||
sprintf(
|
||||
'New source account ID #%d and current destination account ID #%d are the same. Do nothing.',
|
||||
$cashAccount->id,
|
||||
@@ -110,7 +111,7 @@ class SetSourceToCashAccount implements ActionInterface
|
||||
->update(['account_id' => $cashAccount->id])
|
||||
;
|
||||
|
||||
app('log')->debug(sprintf('Updated journal #%d (group #%d) and gave it new source account ID.', $object->id, $object->transaction_group_id));
|
||||
Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new source account ID.', $object->id, $object->transaction_group_id));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user