mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Fixed a bug where a deposit would not get linked to a cash account.
This commit is contained in:
parent
1887977b92
commit
f4b68d26d6
@ -464,6 +464,16 @@ class Account implements CUDInterface, CommonDatabaseCallsInterface, AccountInte
|
|||||||
|
|
||||||
$accountType = $typeRepository->findByWhat('revenue');
|
$accountType = $typeRepository->findByWhat('revenue');
|
||||||
|
|
||||||
|
// if name is "", find cash account:
|
||||||
|
if (strlen($name) == 0) {
|
||||||
|
$cashAccountType = $typeRepository->findByWhat('cash');
|
||||||
|
|
||||||
|
// find or create cash account:
|
||||||
|
return \Account::firstOrCreate(
|
||||||
|
['name' => 'Cash account', 'account_type_id' => $cashAccountType->id, 'active' => 0, 'user_id' => $this->getUser()->id,]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$data = ['user_id' => $this->getUser()->id, 'account_type_id' => $accountType->id, 'name' => $name, 'active' => 1];
|
$data = ['user_id' => $this->getUser()->id, 'account_type_id' => $accountType->id, 'name' => $name, 'active' => 1];
|
||||||
|
|
||||||
return \Account::firstOrCreate($data);
|
return \Account::firstOrCreate($data);
|
||||||
|
Loading…
Reference in New Issue
Block a user