mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Make sure edit of liability always works.
This commit is contained in:
@@ -298,6 +298,11 @@ class AccountUpdateService
|
||||
$openingBalance = $data['opening_balance'];
|
||||
$openingBalanceDate = $data['opening_balance_date'];
|
||||
|
||||
// if liability, make sure the amount is positive for a credit, and negative for a debit.
|
||||
if($this->isLiability($account)) {
|
||||
$openingBalance = 'credit' === $data['liability_direction'] ? app('steam')->positive($openingBalance) : app('steam')->negative($openingBalance);
|
||||
}
|
||||
|
||||
$this->updateOBGroupV2($account, $openingBalance, $openingBalanceDate);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user