diff --git a/.gitignore b/.gitignore index e833f8dbd2..ba92f37af2 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ yarn-error.log public/google*.html report.html composer.phar -app.js.map \ No newline at end of file +app.js.map +frontend-v3 diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index 3ab8eff0bd..5ee8e19516 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -63,9 +63,6 @@ trait JournalServiceTrait // some debug logging: Log::debug(sprintf('Now in getAccount(%s)', $direction), $data); - // final result: - $result = null; - // expected type of source account, in order of preference /** @var array $array */ $array = config('firefly.expected_source_types'); @@ -76,12 +73,17 @@ trait JournalServiceTrait $message = 'Based on the fact that the transaction is a %s, the %s account should be in: %s. Direction is %s.'; Log::debug(sprintf($message, $transactionType, $direction, implode(', ', $expectedTypes[$transactionType] ?? ['UNKNOWN']), $direction)); + Log::debug('Now searching by ID'); $result = $this->findAccountById($data, $expectedTypes[$transactionType]); + Log::debug('If nothing is found, searching by IBAN'); $result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]); + Log::debug('If nothing is found, searching by number'); $result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]); + Log::debug('If nothing is found, searching by name'); $result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]); + Log::debug('If nothing is found, create it.'); $result = $this->createAccount($result, $data, $expectedTypes[$transactionType][0]); - + Log::debug('If cant be created, return cash account.'); return $this->getCashAccount($result, $data, $expectedTypes[$transactionType]); } @@ -118,7 +120,6 @@ trait JournalServiceTrait { // second attempt, find by name. if (null === $account && null !== $data['name']) { - Log::debug('Found nothing by account ID.'); // find by preferred type. $source = $this->accountRepository->findByName($data['name'], [$types[0]]); // or any expected type. @@ -204,7 +205,7 @@ trait JournalServiceTrait if (null !== $account) { Log::debug( sprintf( - 'Was also given %s account #%d ("%s") so will simply return that.', + 'Was given %s account #%d ("%s") so will simply return that.', $account->accountType->type, $account->id, $account->name ) diff --git a/config/firefly.php b/config/firefly.php index 4359b222a6..2bf715bfba 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -667,7 +667,7 @@ return [ TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,], TransactionTypeModel::RECONCILIATION => [AccountType::RECONCILIATION, AccountType::ASSET], - TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], + TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], // in case no transaction type is known yet, it could be anything. 'none' => [ AccountType::ASSET, @@ -686,7 +686,7 @@ return [ TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,], TransactionTypeModel::RECONCILIATION => [AccountType::RECONCILIATION, AccountType::ASSET], - TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], + TransactionTypeModel::LIABILITY_CREDIT => [AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], ], ], 'allowed_opposing_types' => [