Skip to content

Firefly III: a personal finances manager

Fix #2874

James Coleeeb68c1cf4bd
diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php
index 5a297474c5..fdf3e5e896 100644
--- a/app/Support/Http/Controllers/UserNavigation.php
+++ b/app/Support/Http/Controllers/UserNavigation.php
@@ -166,68 +166,6 @@ trait UserNavigation
Log::debug(sprintf('Return direct link %s', $uri));
return $uri;
}
- //
- // /**
- // * Redirect to asset account that transaction belongs to.
- // *
- // * @param TransactionGroup $group
- // *
- // * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- // * @codeCoverageIgnore
- // */
- // protected function redirectToAccount(TransactionGroup $group)
- // {
- // $journals = $group->transactionJournals;
- // $first = $journals->first();
- //
- // if (null === $first) {
- // return redirect(route('index'));
- // }
- //
- // $valid = [AccountType::DEFAULT, AccountType::ASSET];
- // $transactions = $journal->transactions;
- // /** @var Transaction $transaction */
- // foreach ($transactions as $transaction) {
- // $account = $transaction->account;
- // if (in_array($account->accountType->type, $valid, true)) {
- // return redirect(route('accounts.show', [$account->id]));
- // }
- // }
- // // @codeCoverageIgnoreStart
- // session()->flash('error', (string)trans('firefly.cannot_redirect_to_account'));
- //
- // return redirect(route('index'));
- // // @codeCoverageIgnoreEnd
- // }
- //
- // /**
- // * @param Account $account
- // *
- // * @return RedirectResponse|\Illuminate\Routing\Redirector
- // * @codeCoverageIgnore
- // */
- // protected function redirectToOriginalAccount(Account $account)
- // {
- // /** @var Transaction $transaction */
- // $transaction = $account->transactions()->first();
- // if (null === $transaction) {
- // app('session')->flash('error', trans('firefly.account_missing_transaction', ['name' => e($account->name), 'id' => $account->id]));
- // Log::error(sprintf('Expected a transaction. Account #%d has none. BEEP, error.', $account->id));
- //
- // return redirect(route('index'));
- // }
- //
- // $journal = $transaction->transactionJournal;
- // /** @var Transaction $opposingTransaction */
- // $opposingTransaction = $journal->transactions()->where('transactions.id', '!=', $transaction->id)->first();
- //
- // if (null === $opposingTransaction) {
- // app('session')->flash('error', trans('firefly.account_missing_transaction', ['name' => e($account->name), 'id' => $account->id]));
- // Log::error(sprintf('Expected an opposing transaction. Account #%d has none. BEEP, error.', $account->id));
- // }
- //
- // return redirect(route('accounts.show', [$opposingTransaction->account_id]));
- // }
/**
* @param string $identifier
@@ -236,12 +174,12 @@ trait UserNavigation
*/
protected function rememberPreviousUri(string $identifier): ?string
{
- $return = null;
+ $return = app('url')->previous();
/** @var ViewErrorBag $errors */
$errors = session()->get('errors');
$forbidden = ['json'];
if ((null === $errors || (null !== $errors && 0 === $errors->count())) && !Str::contains($return, $forbidden)) {
- $return = app('url')->previous();
+ Log::debug(sprintf('Saving URL %s under key %s', $return, $identifier));
session()->put($identifier, $return);
}
return $return;