mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix for issue #328. Turns out the import routine converts accounts back and forth instead of creating new entries.
This commit is contained in:
@@ -178,10 +178,25 @@ class ImportValidator
|
||||
$result = $repository->findByName($account->name, [$type]);
|
||||
if (is_null($result->id)) {
|
||||
// can convert account:
|
||||
Log::debug(sprintf('No account named %s of type %s, will convert.', $account->name, $type));
|
||||
$result = $repository->updateAccountType($account, $type);
|
||||
|
||||
Log::debug(sprintf('No account named %s of type %s, create new account.', $account->name, $type));
|
||||
$result = $repository->store(
|
||||
[
|
||||
'user' => $this->user->id,
|
||||
'accountType' => config('firefly.shortNamesByFullName.' . $type),
|
||||
'name' => $account->name,
|
||||
'virtualBalance' => 0,
|
||||
'active' => true,
|
||||
'iban' => null,
|
||||
'openingBalance' => 0,
|
||||
]
|
||||
);
|
||||
}
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Using another account named %s (#%d) of type %s, will use that one instead of %s (#%d)', $account->name, $result->id, $type, $account->name,
|
||||
$account->id
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
|
Reference in New Issue
Block a user