Skip to content

Firefly III: a personal finances manager

Fix #1014

James Cole7de512aff8d6
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;