diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 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.twig index 474bf3a0de..89ee1e0094 100644 --- a/resources/views/index.twig +++ b/resources/views/index.twig @@ -61,11 +61,11 @@
@@ -95,7 +95,7 @@