mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-03 19:41:54 +00:00
Fix #11054
This commit is contained in:
@@ -225,6 +225,11 @@ class TransactionJournalFactory
|
|||||||
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo, $sourceAccount);
|
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo, $sourceAccount);
|
||||||
Log::debug('Done with getAccount(2x)');
|
Log::debug('Done with getAccount(2x)');
|
||||||
|
|
||||||
|
// there is a safety catch here. If either account is NULL, they will be replaced with the cash account.
|
||||||
|
if(null === $destinationAccount) {
|
||||||
|
Log::warning('Destination account is NULL, will replace with cash account.');
|
||||||
|
$destinationAccount = $this->accountRepository->getCashAccount();
|
||||||
|
}
|
||||||
|
|
||||||
// this is the moment for a reconciliation sanity check (again).
|
// this is the moment for a reconciliation sanity check (again).
|
||||||
if (TransactionTypeEnum::RECONCILIATION->value === $type->type) {
|
if (TransactionTypeEnum::RECONCILIATION->value === $type->type) {
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ trait JournalServiceTrait
|
|||||||
|
|
||||||
// the account that Firefly III creates must be "creatable", aka select the one we can create from the list just in case
|
// the account that Firefly III creates must be "creatable", aka select the one we can create from the list just in case
|
||||||
$creatableType = $this->getCreatableType($expectedTypes[$transactionType]);
|
$creatableType = $this->getCreatableType($expectedTypes[$transactionType]);
|
||||||
|
Log::debug(sprintf('Creatable type is "%s"', $creatableType ), $expectedTypes[$transactionType]);
|
||||||
|
|
||||||
// if the result is NULL but the ID is set, an account could exist of the wrong type.
|
// if the result is NULL but the ID is set, an account could exist of the wrong type.
|
||||||
// that data can be used to create a new account of the right type.
|
// that data can be used to create a new account of the right type.
|
||||||
@@ -227,9 +228,11 @@ trait JournalServiceTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find by preferred type.
|
// find by preferred type.
|
||||||
|
Log::debug('Find by preferred type.');
|
||||||
$result = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
$result = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
||||||
|
|
||||||
// or any expected type.
|
// or any expected type.
|
||||||
|
Log::debug('Find by any expected type.');
|
||||||
$result ??= $this->accountRepository->findByName($data['name'], $types);
|
$result ??= $this->accountRepository->findByName($data['name'], $types);
|
||||||
|
|
||||||
if (null !== $result) {
|
if (null !== $result) {
|
||||||
|
|||||||
Reference in New Issue
Block a user