mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Small bugs in transaction controller [skip ci]
This commit is contained in:
parent
a44e5da421
commit
683e9b7c2c
@ -125,7 +125,6 @@ class TransactionController extends Controller
|
|||||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
||||||
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
|
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
|
||||||
$budgets[0] = trans('form.noBudget');
|
$budgets[0] = trans('form.noBudget');
|
||||||
$transactions = $journal->transactions()->orderBy('amount', 'DESC')->get();
|
|
||||||
$piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get());
|
$piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get());
|
||||||
$piggies[0] = trans('form.noPiggybank');
|
$piggies[0] = trans('form.noPiggybank');
|
||||||
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
|
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
|
||||||
@ -157,11 +156,25 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$preFilled['amount'] = $journal->actual_amount;
|
$preFilled['amount'] = $journal->actual_amount;
|
||||||
|
|
||||||
|
if ($journal->transactionType->type == 'Withdrawal') {
|
||||||
|
$preFilled['account_id'] = $journal->source_account->id;
|
||||||
|
$preFilled['expense_account'] = $journal->destination_account->name;
|
||||||
|
} else {
|
||||||
$preFilled['account_id'] = $journal->destination_account->id;
|
$preFilled['account_id'] = $journal->destination_account->id;
|
||||||
$preFilled['expense_account'] = $transactions[0]->account->name;
|
$preFilled['revenue_account'] = $journal->source_account->name;
|
||||||
$preFilled['revenue_account'] = $transactions[1]->account->name;
|
}
|
||||||
$preFilled['account_from_id'] = $transactions[1]->account->id;
|
|
||||||
$preFilled['account_to_id'] = $transactions[0]->account->id;
|
if ($journal->destination_account->accountType->type == 'Cash account') {
|
||||||
|
$preFilled['expense_account'] = '';
|
||||||
|
}
|
||||||
|
if ($journal->source_account->accountType->type == 'Cash account') {
|
||||||
|
$preFilled['revenue_account'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$preFilled['account_from_id'] = $journal->source_account->id;
|
||||||
|
$preFilled['account_to_id'] = $journal->destination_account->id;
|
||||||
|
|
||||||
Session::flash('preFilled', $preFilled);
|
Session::flash('preFilled', $preFilled);
|
||||||
Session::flash('gaEventCategory', 'transactions');
|
Session::flash('gaEventCategory', 'transactions');
|
||||||
|
Loading…
Reference in New Issue
Block a user