mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some cleanup and a small bug fix.
This commit is contained in:
parent
cb2863eaf3
commit
136adbe723
@ -145,11 +145,12 @@ class BudgetController extends BaseController
|
||||
App::abort(500);
|
||||
}
|
||||
|
||||
$journals = $this->_repository->getJournals($budget, $repetition);
|
||||
$limits = $repetition ? $budget->limits()->orderBy('startdate', 'DESC')->get() : [$repetition->limit];
|
||||
$subTitle = $repetition ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name);
|
||||
$hideBudget = true; // used in transaction list.
|
||||
$journals = $this->_repository->getJournals($budget, $repetition);
|
||||
$limits = $repetition ? $budget->limits()->orderBy('startdate', 'DESC')->get() : [$repetition->limit];
|
||||
$subTitle = $repetition ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name);
|
||||
|
||||
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle'));
|
||||
return View::make('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle', 'hideBudget'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,7 +182,7 @@ class BudgetController extends BaseController
|
||||
if ($data['post_submit_action'] == 'store') {
|
||||
return Redirect::route('budgets.index');
|
||||
}
|
||||
|
||||
|
||||
// create another.
|
||||
if ($data['post_submit_action'] == 'create_another') {
|
||||
return Redirect::route('budgets.create')->withInput();
|
||||
@ -239,6 +240,7 @@ class BudgetController extends BaseController
|
||||
public function updateIncome()
|
||||
{
|
||||
$budgetAmount = $this->_preferences->get('budgetIncomeTotal' . Session::get('start')->format('FY'), 1000);
|
||||
|
||||
return View::make('budgets.income')->with('amount', $budgetAmount);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
use FireflyIII\Database\Category as CategoryRepository;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
@ -7,13 +8,19 @@ use Illuminate\Support\MessageBag;
|
||||
*/
|
||||
class CategoryController extends BaseController
|
||||
{
|
||||
|
||||
/** @var CategoryRepository */
|
||||
protected $_repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param CategoryRepository $repository
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(CategoryRepository $repository)
|
||||
{
|
||||
View::share('title', 'Categories');
|
||||
View::share('mainTitleIcon', 'fa-bar-chart');
|
||||
|
||||
$this->_repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,11 +48,9 @@ class CategoryController extends BaseController
|
||||
*/
|
||||
public function destroy(Category $category)
|
||||
{
|
||||
/** @var \FireflyIII\Database\Category $repos */
|
||||
$repos = App::make('FireflyIII\Database\Category');
|
||||
Session::flash('success', 'Category "' . e($category->name) . '" was deleted.');
|
||||
$this->_repository->destroy($category);
|
||||
|
||||
$repos->destroy($category);
|
||||
Session::flash('success', 'The category was deleted.');
|
||||
|
||||
return Redirect::route('categories.index');
|
||||
}
|
||||
@ -65,9 +70,7 @@ class CategoryController extends BaseController
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
/** @var \FireflyIII\Database\Category $repos */
|
||||
$repos = App::make('FireflyIII\Database\Category');
|
||||
$categories = $repos->get();
|
||||
$categories = $this->_repository->get();
|
||||
|
||||
return View::make('categories.index', compact('categories'));
|
||||
}
|
||||
@ -79,12 +82,8 @@ class CategoryController extends BaseController
|
||||
*/
|
||||
public function show(Category $category)
|
||||
{
|
||||
$hideCategory = true;
|
||||
|
||||
/** @var \FireflyIII\Database\Category $repos */
|
||||
$repos = App::make('FireflyIII\Database\Category');
|
||||
|
||||
$journals = $repos->getTransactionJournals($category, 50);
|
||||
$hideCategory = true; // used in list.
|
||||
$journals = $this->_repository->getTransactionJournals($category, 50);
|
||||
|
||||
return View::make('categories.show', compact('category', 'journals', 'hideCategory'));
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
|
||||
|
||||
if (!is_null($repetition)) {
|
||||
$setQuery->before($repetition->startdate)->after($repetition->enddate);
|
||||
$countQuery->before($repetition->startdate)->after($repetition->enddate);
|
||||
$setQuery->after($repetition->startdate)->before($repetition->enddate);
|
||||
$countQuery->after($repetition->startdate)->before($repetition->enddate);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user