mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Fix #2874
This commit is contained in:
@@ -166,68 +166,6 @@ trait UserNavigation
|
|||||||
Log::debug(sprintf('Return direct link %s', $uri));
|
Log::debug(sprintf('Return direct link %s', $uri));
|
||||||
return $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
|
* @param string $identifier
|
||||||
@@ -236,12 +174,12 @@ trait UserNavigation
|
|||||||
*/
|
*/
|
||||||
protected function rememberPreviousUri(string $identifier): ?string
|
protected function rememberPreviousUri(string $identifier): ?string
|
||||||
{
|
{
|
||||||
$return = null;
|
$return = app('url')->previous();
|
||||||
/** @var ViewErrorBag $errors */
|
/** @var ViewErrorBag $errors */
|
||||||
$errors = session()->get('errors');
|
$errors = session()->get('errors');
|
||||||
$forbidden = ['json'];
|
$forbidden = ['json'];
|
||||||
if ((null === $errors || (null !== $errors && 0 === $errors->count())) && !Str::contains($return, $forbidden)) {
|
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);
|
session()->put($identifier, $return);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
Reference in New Issue
Block a user