This commit is contained in:
James Cole
2020-04-14 17:23:58 +02:00
parent 852d057a47
commit 54933fda2e
7 changed files with 57 additions and 36 deletions

View File

@@ -237,7 +237,6 @@ trait AccountServiceTrait
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
}
// @codeCoverageIgnoreEnd
return $group;

View File

@@ -345,6 +345,7 @@ trait JournalServiceTrait
*/
private function createAccount(?Account $account, array $data, string $preferredType): Account
{
Log::debug('Now in createAccount()', $data);
// return new account.
if (null === $account) {
$data['name'] = $data['name'] ?? '(no name)';
@@ -362,6 +363,7 @@ trait JournalServiceTrait
'virtual_balance' => null,
'active' => true,
'iban' => $data['iban'],
'currency_id' => $data['currency_id'] ?? null,
]
);
// store BIC
@@ -376,6 +378,14 @@ trait JournalServiceTrait
$metaFactory = app(AccountMetaFactory::class);
$metaFactory->create(['account_id' => $account->id, 'name' => 'account_number', 'data' => $data['bic']]);
}
// // store currency preference:
// if (isset($data['currency_id']) && null !== $data['currency_id']) {
// Log::debug(sprintf('Stored currency_id for account %d with value %d', $account->id, $data['currency_id']));
// /** @var AccountMetaFactory $metaFactory */
// $metaFactory = app(AccountMetaFactory::class);
// $metaFactory->create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $data['currency_id']]);
// }
}
return $account;