diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php index 467d0318c1..134e758e05 100644 --- a/app/controllers/BudgetController.php +++ b/app/controllers/BudgetController.php @@ -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); } } diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.php index 2093aa54e0..b0effea7da 100644 --- a/app/controllers/CategoryController.php +++ b/app/controllers/CategoryController.php @@ -1,4 +1,5 @@ _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')); } diff --git a/app/lib/FireflyIII/Database/Budget.php b/app/lib/FireflyIII/Database/Budget.php index 9f14598cbf..5ed3b18e6d 100644 --- a/app/lib/FireflyIII/Database/Budget.php +++ b/app/lib/FireflyIII/Database/Budget.php @@ -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); }