Skip to content

Firefly III: a personal finances manager

Cleanup.

James Cole8e20b78731f0
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index 40bd302e40..55026e0620 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -91,11 +91,11 @@ class ReportHelper implements ReportHelperInterface
$end = Carbon::now();
$months = [];
while ($start <= $end) {
- $year = $start->format('Y');
+ $year = $start->year;
$months[$year][] = [
'formatted' => $start->format('F Y'),
- 'month' => intval($start->format('m')),
- 'year' => intval($start->format('Y')),
+ 'month' => $start->month,
+ 'year' => $year,
];
$start->addMonth();
}
@@ -114,10 +114,10 @@ class ReportHelper implements ReportHelperInterface
$end = Carbon::now();
$years = [];
while ($start <= $end) {
- $years[] = $start->format('Y');
+ $years[] = $start->year;
$start->addYear();
}
- $years[] = Carbon::now()->format('Y');
+ $years[] = Carbon::now()->year;
// force the current year.
$years = array_unique($years);
diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php
index 465c4167ef..672ae8ff5a 100644
--- a/app/Http/breadcrumbs.php
+++ b/app/Http/breadcrumbs.php
@@ -313,21 +313,21 @@ Breadcrumbs::register(
Breadcrumbs::register(
'reports.year', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index');
- $breadcrumbs->push($date->format('Y'), route('reports.year', $date->format('Y')));
+ $breadcrumbs->push($date->year, route('reports.year', $date->year));
}
);
Breadcrumbs::register(
'reports.month', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index');
- $breadcrumbs->push('Monthly report for ' . $date->format('F Y'), route('reports.month', $date));
+ $breadcrumbs->push('Monthly report for ' . $date->format('F Y'), route('reports.month', [$date->year, $date->month]));
}
);
Breadcrumbs::register(
'reports.budget', function (Generator $breadcrumbs, Carbon $date) {
$breadcrumbs->parent('reports.index');
- $breadcrumbs->push('Budget report for ' . $date->format('F Y'), route('reports.budget', $date));
+ $breadcrumbs->push('Budget report for ' . $date->format('F Y'), route('reports.budget', [$date->year, $date->month]));
}
);
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 9a073acefe..69025ba3b2 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -148,9 +148,8 @@ class Navigation
}
if (isset($specials[$repeatFreq])) {
- $month = intval($theCurrentEnd->format('m'));
$currentEnd->endOfYear();
- if ($month <= 6) {
+ if ($theCurrentEnd->month <= 6) {
$currentEnd->subMonths(6);
}
}
@@ -184,7 +183,7 @@ class Navigation
$date->lastOfQuarter()->addDay();
break;
case '6M':
- if (intval($date->format('m')) >= 7) {
+ if ($date->month >= 7) {
$date->startOfYear()->addYear();
} else {
$date->startOfYear()->addMonths(6);
@@ -230,9 +229,8 @@ class Navigation
return $date;
}
if ($range == '6M') {
- $month = intval($date->format('m'));
$date->startOfYear();
- if ($month <= 6) {
+ if ($date->month <= 6) {
$date->subMonths(6);
}
@@ -260,16 +258,15 @@ class Navigation
return $date->format($formatMap[$range]);
}
if ($range == '3M') {
- $month = intval($date->format('m'));
- return 'Q' . ceil(($month / 12) * 4) . ' ' . $date->format('Y');
+
+ return 'Q' . ceil(($date->month / 12) * 4) . ' ' . $date->year;
}
if ($range == '6M') {
- $month = intval($date->format('m'));
- $half = ceil(($month / 12) * 2);
+ $half = ceil(($date->month / 12) * 2);
$halfName = $half == 1 ? 'first' : 'second';
- return $halfName . ' half of ' . $date->format('Y');
+ return $halfName . ' half of ' . $date->year;
}
throw new FireflyException('No _periodName() for range "' . $range . '"');
}
@@ -333,7 +330,7 @@ class Navigation
return $date;
}
if ($repeatFreq == 'half-year' || $repeatFreq == '6M') {
- $month = intval($date->format('m'));
+ $month = $date->month;
$date->startOfYear();
if ($month >= 7) {
$date->addMonths(6);
@@ -411,7 +408,7 @@ class Navigation
return $end;
}
if ($range == '6M') {
- if (intval($start->format('m')) >= 7) {
+ if ($start->month >= 7) {
$end->endOfYear();
} else {
$end->startOfYear()->addMonths(6);
@@ -445,7 +442,7 @@ class Navigation
return $start;
}
if ($range == '6M') {
- if (intval($start->format('m')) >= 7) {
+ if ($start->month >= 7) {
$start->startOfYear()->addMonths(6);
} else {
$start->startOfYear();
diff --git a/tests/controllers/BillControllerTest.php b/tests/controllers/BillControllerTest.php
index 3bead2d0d0..846e63298a 100644
--- a/tests/controllers/BillControllerTest.php
+++ b/tests/controllers/BillControllerTest.php
@@ -75,7 +75,7 @@ class BillControllerTest extends TestCase
Amount::shouldReceive('getCurrencyCode')->andReturn('X');
$this->call('GET', '/bills/create');
- $this->assertViewHas('subTitle', 'Create new');
+ $this->assertViewHas('subTitle', 'Create new bill');
$this->assertResponseOk();
}