mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Code cleanup.
This commit is contained in:
@@ -63,7 +63,7 @@ class ReportController extends Controller
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.reports'));
|
||||
app('view')->share('title', (string)trans('firefly.reports'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('subTitleIcon', 'fa-calendar');
|
||||
$this->helper = app(ReportHelperInterface::class);
|
||||
@@ -81,14 +81,14 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function auditReport(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -117,14 +117,14 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function budgetReport(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -154,14 +154,14 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function categoryReport(Collection $accounts, Collection $categories, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
@@ -190,14 +190,14 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function defaultReport(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date'));
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
|
||||
$this->repository->cleanupBudgets();
|
||||
@@ -227,8 +227,8 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function doubleReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -330,10 +330,10 @@ class ReportController extends Controller
|
||||
*
|
||||
* @param ReportFormRequest $request
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
*/
|
||||
public function postIndex(ReportFormRequest $request)
|
||||
{
|
||||
@@ -349,37 +349,37 @@ class ReportController extends Controller
|
||||
|
||||
if (0 === $request->getAccountList()->count()) {
|
||||
Log::debug('Account count is zero');
|
||||
session()->flash('error', (string) trans('firefly.select_at_least_one_account'));
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_account'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
}
|
||||
|
||||
if ('category' === $reportType && 0 === $request->getCategoryList()->count()) {
|
||||
session()->flash('error', (string) trans('firefly.select_at_least_one_category'));
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_category'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
}
|
||||
|
||||
if ('budget' === $reportType && 0 === $request->getBudgetList()->count()) {
|
||||
session()->flash('error', (string) trans('firefly.select_at_least_one_budget'));
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_budget'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
}
|
||||
|
||||
if ('tag' === $reportType && 0 === $request->getTagList()->count()) {
|
||||
session()->flash('error', (string) trans('firefly.select_at_least_one_tag'));
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_tag'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
}
|
||||
|
||||
if ('double' === $reportType && 0 === $request->getDoubleList()->count()) {
|
||||
session()->flash('error', (string) trans('firefly.select_at_least_one_expense'));
|
||||
session()->flash('error', (string)trans('firefly.select_at_least_one_expense'));
|
||||
|
||||
return redirect(route('reports.index'));
|
||||
}
|
||||
|
||||
if ($request->getEndDate() < $request->getStartDate()) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date'));
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date'));
|
||||
}
|
||||
|
||||
switch ($reportType) {
|
||||
@@ -406,6 +406,7 @@ class ReportController extends Controller
|
||||
|
||||
return redirect($uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a tag report.
|
||||
*
|
||||
@@ -414,13 +415,13 @@ class ReportController extends Controller
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @return Factory|View|string
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
|
||||
{
|
||||
if ($end < $start) {
|
||||
return prefixView('error')->with('message', (string) trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
return prefixView('error')->with('message', (string)trans('firefly.end_after_start_date')); // @codeCoverageIgnore
|
||||
}
|
||||
$this->repository->cleanupBudgets();
|
||||
|
||||
|
Reference in New Issue
Block a user