mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-15 22:28:14 +00:00
This is a fix for #487
This commit is contained in:
@@ -438,7 +438,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$amount = $data['openingBalance'];
|
||||
$name = $data['name'];
|
||||
$opposing = $this->storeOpposingAccount($amount, $name);
|
||||
$opposing = $this->storeOpposingAccount($name);
|
||||
$transactionType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
|
||||
$journal = TransactionJournal::create(
|
||||
[
|
||||
@@ -481,17 +481,16 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*
|
||||
* @return Account
|
||||
*/
|
||||
protected function storeOpposingAccount(float $amount, string $name): Account
|
||||
protected function storeOpposingAccount(string $name): Account
|
||||
{
|
||||
$type = $amount < 0 ? 'expense' : 'revenue';
|
||||
$opposingData = [
|
||||
'accountType' => $type,
|
||||
'accountType' => 'initial',
|
||||
'name' => $name . ' initial balance',
|
||||
'active' => false,
|
||||
'iban' => '',
|
||||
'virtualBalance' => 0,
|
||||
];
|
||||
Log::debug('Going to create an opening balance opposing account');
|
||||
Log::debug('Going to create an opening balance opposing account.');
|
||||
|
||||
return $this->storeAccount($opposingData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user