From 7de512aff8d6226fbb67c2938abc8a145ed133dc Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 24 Nov 2017 17:33:05 +0100 Subject: [PATCH] Fix #1014 --- app/Http/Controllers/Transaction/SingleController.php | 4 +++- public/js/ff/transactions/single/common.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 7d6f23f26c..a1c459916c 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -40,6 +40,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; +use Illuminate\Http\Request; use Log; use Preferences; use Session; @@ -153,9 +154,10 @@ class SingleController extends Controller * * @return View */ - public function create(string $what = TransactionType::DEPOSIT) + public function create(Request $request, string $what = TransactionType::DEPOSIT) { $what = strtolower($what); + $what = $request->old('what') ?? $what; $uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size'))); $assetAccounts = $this->groupedActiveAccountList(); $budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets()); diff --git a/public/js/ff/transactions/single/common.js b/public/js/ff/transactions/single/common.js index 61599512ad..eed4fbea7c 100644 --- a/public/js/ff/transactions/single/common.js +++ b/public/js/ff/transactions/single/common.js @@ -107,6 +107,10 @@ function selectsForeignCurrency() { if (foreignCurrencyId === nativeCurrencyId) { $('#exchange_rate_instruction_holder').hide(); $('#native_amount_holder').hide(); + + // make all other inputs empty + $('input[name="destination_amount"]').val(""); + $('input[name="native_amount"]').val(""); } return false;