This commit is contained in:
James Cole
2018-09-10 16:18:35 +02:00
parent 34202dea1d
commit 155480b335
9 changed files with 128 additions and 48 deletions

View File

@@ -40,7 +40,12 @@ class AssetAccountIbans implements MapperInterface
{
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$set = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$set = $accountRepository->getAccountsByType(
[AccountType::DEFAULT, AccountType::ASSET,
AccountType::LOAN, AccountType::DEBT,
AccountType::CREDITCARD, AccountType::MORTGAGE,
]
);
$topList = [];
$list = [];
@@ -49,10 +54,22 @@ class AssetAccountIbans implements MapperInterface
$iban = $account->iban ?? '';
$accountId = (int)$account->id;
if (\strlen($iban) > 0) {
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
$name = $account->iban . ' (' . $account->name . ')';
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$topList[$accountId] = $name;
}
if ('' === $iban) {
$list[$accountId] = $account->name;
$name = $account->name;
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$list[$accountId] = $name;
}
}
/** @noinspection AdditionOperationOnArraysInspection */

View File

@@ -40,7 +40,7 @@ class AssetAccounts implements MapperInterface
{
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$set = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$set = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE,]);
$list = [];
/** @var Account $account */
@@ -51,6 +51,12 @@ class AssetAccounts implements MapperInterface
if (\strlen($iban) > 0) {
$name .= ' (' . $iban . ')';
}
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = trans('import.import_liability_select') . ': ' . $name;
}
$list[$accountId] = $name;
}
asort($list);

View File

@@ -44,7 +44,8 @@ class OpposingAccountIbans implements MapperInterface
[
AccountType::DEFAULT, AccountType::ASSET,
AccountType::EXPENSE, AccountType::BENEFICIARY,
AccountType::REVENUE,
AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT,
AccountType::CREDITCARD, AccountType::MORTGAGE,
]
);
$topList = [];
@@ -55,10 +56,23 @@ class OpposingAccountIbans implements MapperInterface
$iban = $account->iban ?? '';
$accountId = (int)$account->id;
if (\strlen($iban) > 0) {
$topList[$accountId] = $account->iban . ' (' . $account->name . ')';
$name = $account->iban . ' (' . $account->name . ')';
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$topList[$accountId] = $name;
}
if ('' === $iban) {
$list[$accountId] = $account->name;
$name = $account->name;
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = $name . ' (' . strtolower(trans('import.import_liability_select')) . ')';
}
$list[$accountId] = $name;
}
}
/** @noinspection AdditionOperationOnArraysInspection */

View File

@@ -44,7 +44,8 @@ class OpposingAccounts implements MapperInterface
[
AccountType::DEFAULT, AccountType::ASSET,
AccountType::EXPENSE, AccountType::BENEFICIARY,
AccountType::REVENUE,
AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT,
AccountType::CREDITCARD, AccountType::MORTGAGE,
]
);
$list = [];
@@ -57,6 +58,10 @@ class OpposingAccounts implements MapperInterface
if (\strlen($iban) > 0) {
$name .= ' (' . $iban . ')';
}
// is a liability?
if (\in_array($account->accountType->type, [AccountType::LOAN, AccountType::DEBT, AccountType::CREDITCARD, AccountType::MORTGAGE], true)) {
$name = trans('import.import_liability_select') . ': ' . $name;
}
$list[$accountId] = $name;
}
asort($list);