Possible fix for #5869

This commit is contained in:
James Cole
2022-03-10 17:57:43 +01:00
parent ca7c86a057
commit 07813fa858
2 changed files with 4 additions and 5 deletions

View File

@@ -66,7 +66,7 @@ class SetDestinationAccount implements ActionInterface
return false; return false;
} }
$type = $object->transactionType->type;
$this->repository->setUser($user); $this->repository->setUser($user);
// if this is a transfer or a deposit, the new destination account must be an asset account or a default account, and it MUST exist: // if this is a transfer or a deposit, the new destination account must be an asset account or a default account, and it MUST exist:

View File

@@ -58,15 +58,14 @@ class SetSourceAccount implements ActionInterface
$user = User::find($journal['user_id']); $user = User::find($journal['user_id']);
$type = $journal['transaction_type_type']; $type = $journal['transaction_type_type'];
/** @var TransactionJournal|null $object */ /** @var TransactionJournal|null $object */
$object = $user->transactionJournals()->find((int)$journal['transaction_journal_id']); $object = $user->transactionJournals()->find((int) $journal['transaction_journal_id']);
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
if (null === $object) { if (null === $object) {
Log::error('Could not find journal.'); Log::error('Could not find journal.');
return false; return false;
} }
$type = $object->transactionType->type;
$this->repository->setUser($user); $this->repository->setUser($user);
// if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist: // if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist:
@@ -93,7 +92,7 @@ class SetSourceAccount implements ActionInterface
return false; return false;
} }
if (null !== $newAccount && (int)$newAccount->id === (int)$destination->account_id) { if (null !== $newAccount && (int) $newAccount->id === (int) $destination->account_id) {
Log::error( Log::error(
sprintf( sprintf(
'New source account ID #%d and current destination account ID #%d are the same. Do nothing.', $newAccount->id, 'New source account ID #%d and current destination account ID #%d are the same. Do nothing.', $newAccount->id,