Fix opening balance bug #214

This commit is contained in:
James Cole 2016-03-18 16:29:08 +01:00
parent f6303deaa4
commit ccad52b80f

View File

@ -450,8 +450,9 @@ class AccountRepository implements AccountRepositoryInterface
$this->updateMetadata($account, $data);
$openingBalance = $this->openingBalanceTransaction($account);
if ($data['openingBalance'] != 0) {
if ($openingBalance) {
if (!is_null($openingBalance->id)) {
$this->updateInitialBalance($account, $openingBalance, $data);
} else {
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';