This commit is contained in:
James Cole
2017-02-05 08:26:54 +01:00
parent b68d5c4374
commit 3e510bd3f6
15 changed files with 118 additions and 170 deletions

View File

@@ -31,7 +31,6 @@ use Log;
use Preferences;
use Session;
use Steam;
use URL;
use View;
/**
@@ -140,8 +139,7 @@ class SingleController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('transactions.create.fromStore') !== true) {
$url = URL::previous();
Session::put('transactions.create.url', $url);
$this->rememberPreviousUri('transactions.create.uri');
}
Session::forget('transactions.create.fromStore');
Session::flash('gaEventCategory', 'transactions');
@@ -172,7 +170,7 @@ class SingleController extends Controller
$subTitle = trans('firefly.delete_' . $what, ['description' => $journal->description]);
// put previous url in session
Session::put('transactions.delete.url', URL::previous());
$this->rememberPreviousUri('transactions.delete.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'delete-' . $what);
@@ -200,13 +198,7 @@ class SingleController extends Controller
Preferences::mark();
$uri = session('transactions.delete.url');
if (!(strpos($uri, sprintf('transactions/show/%s', $journalId)) === false)) {
// uri would point back to transaction
$uri = route('transactions.index', [strtolower($type)]);
}
return redirect($uri);
return redirect($this->getPreviousUri('transactions.delete.uri'));
}
/**
@@ -275,7 +267,7 @@ class SingleController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('transactions.edit.fromUpdate') !== true) {
Session::put('transactions.edit.url', URL::previous());
$this->rememberPreviousUri('transactions.edit.uri');
}
Session::forget('transactions.edit.fromUpdate');
@@ -336,7 +328,7 @@ class SingleController extends Controller
// redirect to previous URL.
return redirect(session('transactions.create.url'));
return redirect($this->getPreviousUri('transactions.create.uri'));
}
@@ -386,7 +378,6 @@ class SingleController extends Controller
}
// redirect to previous URL.
return redirect(session('transactions.edit.url'));
return redirect($this->getPreviousUri('transactions.edit.uri'));
}
}