mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
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:
parent
7fbd0b2ffc
commit
28c753523f
@ -136,6 +136,12 @@ class TransactionController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(AccountRepositoryInterface $repository, TransactionJournal $journal)
|
public function edit(AccountRepositoryInterface $repository, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
|
// cannot edit opening balance
|
||||||
|
if ($journal->transactionType->type == 'Opening balance') {
|
||||||
|
return view('error')->with('message', 'Cannot edit this transaction. Edit the account instead!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize'));
|
$maxFileSize = Steam::phpBytes(ini_get('upload_max_filesize'));
|
||||||
$maxPostSize = Steam::phpBytes(ini_get('post_max_size'));
|
$maxPostSize = Steam::phpBytes(ini_get('post_max_size'));
|
||||||
$uploadSize = min($maxFileSize, $maxPostSize);
|
$uploadSize = min($maxFileSize, $maxPostSize);
|
||||||
@ -333,6 +339,11 @@ class TransactionController extends Controller
|
|||||||
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, AttachmentHelperInterface $att, TransactionJournal $journal)
|
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, AttachmentHelperInterface $att, TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// cannot edit opening balance
|
||||||
|
if ($journal->transactionType->type == 'Opening balance') {
|
||||||
|
return view('error')->with('message', 'Cannot edit this transaction. Edit the account instead!');
|
||||||
|
}
|
||||||
|
|
||||||
$journalData = $request->getJournalData();
|
$journalData = $request->getJournalData();
|
||||||
$repository->update($journal, $journalData);
|
$repository->update($journal, $journalData);
|
||||||
|
|
||||||
|
@ -375,6 +375,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
return TransactionJournal
|
return TransactionJournal
|
||||||
::orderBy('transaction_journals.date', 'ASC')
|
::orderBy('transaction_journals.date', 'ASC')
|
||||||
->accountIs($account)
|
->accountIs($account)
|
||||||
|
->transactionTypes(['Opening balance'])
|
||||||
->orderBy('created_at', 'ASC')
|
->orderBy('created_at', 'ASC')
|
||||||
->first(['transaction_journals.*']);
|
->first(['transaction_journals.*']);
|
||||||
}
|
}
|
||||||
@ -394,10 +395,9 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
|
|
||||||
// continue with the opposing account:
|
// continue with the opposing account:
|
||||||
if ($data['openingBalance'] != 0) {
|
if ($data['openingBalance'] != 0) {
|
||||||
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
|
||||||
$opposingData = [
|
$opposingData = [
|
||||||
'user' => $data['user'],
|
'user' => $data['user'],
|
||||||
'accountType' => $type,
|
'accountType' => 'initial',
|
||||||
'virtualBalance' => 0,
|
'virtualBalance' => 0,
|
||||||
'name' => $data['name'] . ' initial balance',
|
'name' => $data['name'] . ' initial balance',
|
||||||
'active' => false,
|
'active' => false,
|
||||||
|
Loading…
Reference in New Issue
Block a user