mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 07:08:19 +00:00
Merge branch 'release/3.3.6'
Conflicts: app/Http/Controllers/CategoryController.php
This commit is contained in:
@@ -11,7 +11,7 @@ use Input;
|
||||
use Redirect;
|
||||
use Session;
|
||||
use View;
|
||||
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class CategoryController
|
||||
@@ -35,6 +35,12 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
// put previous url in session if not redirect from store (not "create another").
|
||||
if (Session::get('categories.create.fromStore') !== true) {
|
||||
Session::put('categories.create.url', URL::previous());
|
||||
}
|
||||
Session::forget('categories.create.fromStore');
|
||||
|
||||
return view('categories.create')->with('subTitle', 'Create a new category');
|
||||
}
|
||||
|
||||
@@ -47,6 +53,9 @@ class CategoryController extends Controller
|
||||
{
|
||||
$subTitle = 'Delete category' . e($category->name) . '"';
|
||||
|
||||
// put previous url in session
|
||||
Session::put('categories.delete.url', URL::previous());
|
||||
|
||||
return view('categories.delete', compact('category', 'subTitle'));
|
||||
}
|
||||
|
||||
@@ -63,7 +72,7 @@ class CategoryController extends Controller
|
||||
|
||||
Session::flash('success', 'The category "' . e($name) . '" was deleted.');
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
return Redirect::to(Session::get('categories.delete.url'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,6 +84,12 @@ class CategoryController extends Controller
|
||||
{
|
||||
$subTitle = 'Edit category "' . e($category->name) . '"';
|
||||
|
||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||
if (Session::get('categories.edit.fromUpdate') !== true) {
|
||||
Session::put('categories.edit.url', URL::previous());
|
||||
}
|
||||
Session::forget('categories.edit.fromUpdate');
|
||||
|
||||
return view('categories.edit', compact('category', 'subTitle'));
|
||||
|
||||
}
|
||||
@@ -89,10 +104,10 @@ class CategoryController extends Controller
|
||||
$categories->each(
|
||||
function (Category $category) {
|
||||
$latest = $category->transactionjournals()
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order','ASC')
|
||||
->orderBy('transaction_journals.id','DESC')
|
||||
->first();
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->first();
|
||||
if ($latest) {
|
||||
$category->lastActivity = $latest->date;
|
||||
}
|
||||
@@ -115,9 +130,9 @@ class CategoryController extends Controller
|
||||
->whereNull('category_transaction_journal.id')
|
||||
->before($end)
|
||||
->after($start)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order','ASC')
|
||||
->orderBy('transaction_journals.id','DESC')
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->get(['transaction_journals.*']);
|
||||
|
||||
$subTitle = 'Transactions without a category between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y');
|
||||
@@ -136,14 +151,12 @@ class CategoryController extends Controller
|
||||
$page = intval(Input::get('page'));
|
||||
$offset = $page > 0 ? $page * 50 : 0;
|
||||
$set = $category->transactionJournals()->withRelevantData()->take(50)->offset($offset)
|
||||
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order','ASC')
|
||||
->orderBy('transaction_journals.id','DESC')
|
||||
|
||||
->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->get(
|
||||
['transaction_journals.*']
|
||||
);
|
||||
$count = $category->transactionJournals()->count();
|
||||
|
||||
$journals = new LengthAwarePaginator($set, $count, 50, $page);
|
||||
@@ -166,16 +179,22 @@ class CategoryController extends Controller
|
||||
$category = $repository->store($categoryData);
|
||||
|
||||
Session::flash('success', 'New category "' . $category->name . '" stored!');
|
||||
|
||||
|
||||
if (intval(Input::get('create_another')) === 1) {
|
||||
Session::put('categories.create.fromStore', true);
|
||||
return Redirect::route('categories.create')->withInput();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (intval(Input::get('create_another')) === 1) {
|
||||
return Redirect::route('categories.create');
|
||||
}
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
=======
|
||||
// redirect to previous URL.
|
||||
return Redirect::to(Session::get('categories.create.url'));
|
||||
>>>>>>> release/3.3.6
|
||||
|
||||
}
|
||||
|
||||
@@ -198,10 +217,12 @@ class CategoryController extends Controller
|
||||
Session::flash('success', 'Category "' . $category->name . '" updated.');
|
||||
|
||||
if (intval(Input::get('return_to_edit')) === 1) {
|
||||
Session::put('categories.edit.fromUpdate', true);
|
||||
return Redirect::route('categories.edit', $category->id);
|
||||
}
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
// redirect to previous URL.
|
||||
return Redirect::to(Session::get('categories.edit.url'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user