mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2874
This commit is contained in:
parent
3a775627b5
commit
eeb68c1cf4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user