Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code to fix #1185
James Cole9f9feea15972
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.phpindex 7f64c9cbd8..4411830bf6 100644--- a/app/Http/Controllers/Transaction/SingleController.php+++ b/app/Http/Controllers/Transaction/SingleController.php@@ -109,7 +109,7 @@ class SingleController extends Controller$budgetId = $this->repository->getJournalBudgetId($journal);$categoryName = $this->repository->getJournalCategoryName($journal);- $tags = join(',',$this->repository->getTags($journal));+ $tags = join(',', $this->repository->getTags($journal));// todo less direct database access. Use collector?/** @var Transaction $transaction */$transaction = $journal->transactions()->first();@@ -171,6 +171,14 @@ class SingleController extends Controller$subTitle = trans('form.add_new_' . $what);$subTitleIcon = 'fa-plus';$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;+ $source = intval($request->get('source'));++ if (($what === 'withdrawal' || $what === 'transfer') && $source > 0) {+ $preFilled['source_account_id'] = $source;+ }+ if ($what === 'deposit' && $source > 0) {+ $preFilled['destination_account_id'] = $source;+ }Session::put('preFilled', $preFilled);diff --git a/resources/views/index.twig b/resources/views/index.twigindex 474bf3a0de..89ee1e0094 100644--- a/resources/views/index.twig+++ b/resources/views/index.twig@@ -61,11 +61,11 @@<div class="btn-group"><button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button><ul class="dropdown-menu" role="menu">- <li><a href="{{ route('transactions.create','withdrawal') }}"><i+ <li><a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}"><iclass="fa fa-long-arrow-left fa-fw"></i> {{ 'newWithdrawal'|_ }}</a></li>- <li><a href="{{ route('transactions.create','deposit') }}"><i+ <li><a href="{{ route('transactions.create','deposit') }}?source={{ data[1].id }}"><iclass="fa fa-long-arrow-right fa-fw"></i> {{ 'newDeposit'|_ }}</a></li>- <li><a href="{{ route('transactions.create','transfer') }}"><i+ <li><a href="{{ route('transactions.create','transfer') }}?source={{ data[1].id }}"><iclass="fa fa-fw fa-exchange"></i> {{ 'newTransfer'|_ }}</a></li></ul></div>@@ -95,7 +95,7 @@<div class="btn-group" role="group" aria-label="..."><div class="btn-group" role="group">- <a href="{{ route('transactions.create','withdrawal') }}" class="btn btn-success"><i+ <a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}" class="btn btn-success"><iclass="fa fa-plus fa-fw"></i> {{ 'create_new_transaction'|_ }}</a><button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"aria-expanded="false">@@ -103,11 +103,11 @@<span class="sr-only">Toggle Dropdown</span></button><ul class="dropdown-menu">- <li><a href="{{ route('transactions.create','withdrawal') }}"><i+ <li><a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}"><iclass="fa fa-long-arrow-left fa-fw"></i> {{ 'newWithdrawal'|_ }}</a></li>- <li><a href="{{ route('transactions.create','deposit') }}"><i+ <li><a href="{{ route('transactions.create','deposit') }}?source={{ data[1].id }}"><iclass="fa fa-long-arrow-right fa-fw"></i> {{ 'newDeposit'|_ }}</a></li>- <li><a href="{{ route('transactions.create','transfer') }}"><i+ <li><a href="{{ route('transactions.create','transfer') }}?source={{ data[1].id }}"><iclass="fa fa-fw fa-exchange"></i> {{ 'newTransfer'|_ }}</a></li></ul>