add some fixes for #1111

This commit is contained in:
James Cole
2018-01-24 05:17:26 +01:00
parent 9a26d6d49f
commit 89cf351ad0

View File

@@ -48,6 +48,9 @@ class ReportController extends Controller
/** @var ReportHelperInterface */ /** @var ReportHelperInterface */
protected $helper; protected $helper;
/** @var BudgetRepositoryInterface */
private $repository;
/** /**
* *
*/ */
@@ -55,13 +58,13 @@ class ReportController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->helper = app(ReportHelperInterface::class);
$this->middleware( $this->middleware(
function ($request, $next) { function ($request, $next) {
app('view')->share('title', trans('firefly.reports')); app('view')->share('title', trans('firefly.reports'));
app('view')->share('mainTitleIcon', 'fa-line-chart'); app('view')->share('mainTitleIcon', 'fa-line-chart');
View::share('subTitleIcon', 'fa-calendar'); View::share('subTitleIcon', 'fa-calendar');
$this->helper = app(ReportHelperInterface::class);
$this->repository = app(BudgetRepositoryInterface::class);
return $next($request); return $next($request);
} }
@@ -87,6 +90,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', trans( 'subTitle', trans(
@@ -120,6 +124,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', 'subTitle',
@@ -157,6 +162,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', 'subTitle',
@@ -195,6 +201,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', 'subTitle',
@@ -233,6 +240,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', 'subTitle',
@@ -265,6 +273,7 @@ class ReportController extends Controller
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data; $customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); $accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$accountList = join(',', $accounts->pluck('id')->toArray()); $accountList = join(',', $accounts->pluck('id')->toArray());
$this->repository->cleanupBudgets();
return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear')); return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));
} }
@@ -391,6 +400,7 @@ class ReportController extends Controller
if ($start < session('first')) { if ($start < session('first')) {
$start = session('first'); $start = session('first');
} }
$this->repository->cleanupBudgets();
View::share( View::share(
'subTitle', 'subTitle',