diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index 19ad0f357f..47da02f884 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -122,7 +122,7 @@ class EditController extends Controller } $request->session()->forget('accounts.edit.fromUpdate'); - $openingBalanceAmount = app('steam')->positive((string)$repository->getOpeningBalanceAmount($account)); + $openingBalanceAmount = (string)$repository->getOpeningBalanceAmount($account); if ('0' === $openingBalanceAmount) { $openingBalanceAmount = ''; } diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 4ce0545519..2ea1715b4f 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -530,6 +530,7 @@ trait AccountServiceTrait if (null === $obGroup) { return $this->createOBGroupV2($account, $openingBalance, $openingBalanceDate); } + Log::debug('Update OB group'); // if exists, update: $currency = $this->accountRepository->getAccountCurrency($account); @@ -547,6 +548,7 @@ trait AccountServiceTrait // if amount is negative: if (1 === bccomp('0', $openingBalance)) { + Log::debug('Amount is negative.'); // account transaction loses money: $accountTransaction->amount = app('steam')->negative($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; @@ -556,6 +558,7 @@ trait AccountServiceTrait $obTransaction->transaction_currency_id = $currency->id; } if (-1 === bccomp('0', $openingBalance)) { + Log::debug('Amount is positive.'); // account gains money: $accountTransaction->amount = app('steam')->positive($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index ed7ff3d51c..16e9d7f2ec 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -292,7 +292,6 @@ class AccountUpdateService */ private function updateOpeningBalance(Account $account, array $data): void { - // has valid initial balance (IB) data? $type = $account->accountType; if (in_array($type->type, $this->canHaveOpeningBalance, true)) {