Caught a nasty bug thanks to an alert Tweakers.net user. This fix will make the account-edit screen inconsistent for a select number of users. This will be detailed on the wiki.

This commit is contained in:
James Cole
2015-08-15 21:45:29 +02:00
parent 7fbd0b2ffc
commit 28c753523f
2 changed files with 13 additions and 2 deletions

View File

@@ -375,6 +375,7 @@ class AccountRepository implements AccountRepositoryInterface
return TransactionJournal
::orderBy('transaction_journals.date', 'ASC')
->accountIs($account)
->transactionTypes(['Opening balance'])
->orderBy('created_at', 'ASC')
->first(['transaction_journals.*']);
}
@@ -394,10 +395,9 @@ class AccountRepository implements AccountRepositoryInterface
// continue with the opposing account:
if ($data['openingBalance'] != 0) {
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
$opposingData = [
'user' => $data['user'],
'accountType' => $type,
'accountType' => 'initial',
'virtualBalance' => 0,
'name' => $data['name'] . ' initial balance',
'active' => false,