mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,4 +15,5 @@ yarn-error.log
|
|||||||
public/google*.html
|
public/google*.html
|
||||||
report.html
|
report.html
|
||||||
composer.phar
|
composer.phar
|
||||||
app.js.map
|
app.js.map
|
||||||
|
frontend-v3
|
||||||
|
@@ -63,9 +63,6 @@ trait JournalServiceTrait
|
|||||||
// some debug logging:
|
// some debug logging:
|
||||||
Log::debug(sprintf('Now in getAccount(%s)', $direction), $data);
|
Log::debug(sprintf('Now in getAccount(%s)', $direction), $data);
|
||||||
|
|
||||||
// final result:
|
|
||||||
$result = null;
|
|
||||||
|
|
||||||
// expected type of source account, in order of preference
|
// expected type of source account, in order of preference
|
||||||
/** @var array $array */
|
/** @var array $array */
|
||||||
$array = config('firefly.expected_source_types');
|
$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.';
|
$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(sprintf($message, $transactionType, $direction, implode(', ', $expectedTypes[$transactionType] ?? ['UNKNOWN']), $direction));
|
||||||
|
|
||||||
|
Log::debug('Now searching by ID');
|
||||||
$result = $this->findAccountById($data, $expectedTypes[$transactionType]);
|
$result = $this->findAccountById($data, $expectedTypes[$transactionType]);
|
||||||
|
Log::debug('If nothing is found, searching by IBAN');
|
||||||
$result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]);
|
$result = $this->findAccountByIban($result, $data, $expectedTypes[$transactionType]);
|
||||||
|
Log::debug('If nothing is found, searching by number');
|
||||||
$result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]);
|
$result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]);
|
||||||
|
Log::debug('If nothing is found, searching by name');
|
||||||
$result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]);
|
$result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]);
|
||||||
|
Log::debug('If nothing is found, create it.');
|
||||||
$result = $this->createAccount($result, $data, $expectedTypes[$transactionType][0]);
|
$result = $this->createAccount($result, $data, $expectedTypes[$transactionType][0]);
|
||||||
|
Log::debug('If cant be created, return cash account.');
|
||||||
return $this->getCashAccount($result, $data, $expectedTypes[$transactionType]);
|
return $this->getCashAccount($result, $data, $expectedTypes[$transactionType]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +120,6 @@ trait JournalServiceTrait
|
|||||||
{
|
{
|
||||||
// second attempt, find by name.
|
// second attempt, find by name.
|
||||||
if (null === $account && null !== $data['name']) {
|
if (null === $account && null !== $data['name']) {
|
||||||
Log::debug('Found nothing by account ID.');
|
|
||||||
// find by preferred type.
|
// find by preferred type.
|
||||||
$source = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
$source = $this->accountRepository->findByName($data['name'], [$types[0]]);
|
||||||
// or any expected type.
|
// or any expected type.
|
||||||
@@ -204,7 +205,7 @@ trait JournalServiceTrait
|
|||||||
if (null !== $account) {
|
if (null !== $account) {
|
||||||
Log::debug(
|
Log::debug(
|
||||||
sprintf(
|
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
|
$account->accountType->type, $account->id, $account->name
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@@ -667,7 +667,7 @@ return [
|
|||||||
TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT,
|
TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT,
|
||||||
AccountType::MORTGAGE,],
|
AccountType::MORTGAGE,],
|
||||||
TransactionTypeModel::RECONCILIATION => [AccountType::RECONCILIATION, AccountType::ASSET],
|
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.
|
// in case no transaction type is known yet, it could be anything.
|
||||||
'none' => [
|
'none' => [
|
||||||
AccountType::ASSET,
|
AccountType::ASSET,
|
||||||
@@ -686,7 +686,7 @@ return [
|
|||||||
TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT,
|
TransactionTypeModel::OPENING_BALANCE => [AccountType::INITIAL_BALANCE, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT,
|
||||||
AccountType::MORTGAGE,],
|
AccountType::MORTGAGE,],
|
||||||
TransactionTypeModel::RECONCILIATION => [AccountType::RECONCILIATION, AccountType::ASSET],
|
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' => [
|
'allowed_opposing_types' => [
|
||||||
|
Reference in New Issue
Block a user