Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/issues/7974

James Cole549f3c038a4e
diff --git a/app/Api/V1/Controllers/Models/Transaction/ShowController.php b/app/Api/V1/Controllers/Models/Transaction/ShowController.php
index 03749f831a..b7c63b9520 100644
--- a/app/Api/V1/Controllers/Models/Transaction/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/ShowController.php
@@ -80,7 +80,7 @@ class ShowController extends Controller
->setPage($this->parameters->get('page'))
// set types of transactions to return.
->setTypes($types);
- if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
+ if (null !== $this->parameters->get('start') || null !== $this->parameters->get('end')) {
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
}
$paginator = $collector->getPaginatedGroups();
diff --git a/app/Helpers/Collector/Extensions/TimeCollection.php b/app/Helpers/Collector/Extensions/TimeCollection.php
index bfb438e182..3908686d69 100644
--- a/app/Helpers/Collector/Extensions/TimeCollection.php
+++ b/app/Helpers/Collector/Extensions/TimeCollection.php
@@ -819,22 +819,28 @@ trait TimeCollection
/**
* Set the start and end time of the results to return.
*
- * @param Carbon $start
- * @param Carbon $end
+ * Can either or both be NULL
+ *
+ * @param Carbon|null $start
+ * @param Carbon|null $end
*
* @return GroupCollectorInterface
*/
- public function setRange(Carbon $start, Carbon $end): GroupCollectorInterface
+ public function setRange(?Carbon $start, ?Carbon $end): GroupCollectorInterface
{
- if ($end < $start) {
+ if (null !== $start && null !== $end && $end < $start) {
[$start, $end] = [$end, $start];
}
// always got to end of day / start of day for ranges.
- $startStr = $start->format('Y-m-d 00:00:00');
- $endStr = $end->format('Y-m-d 23:59:59');
+ $startStr = $start?->format('Y-m-d 00:00:00');
+ $endStr = $end?->format('Y-m-d 23:59:59');
- $this->query->where('transaction_journals.date', '>=', $startStr);
- $this->query->where('transaction_journals.date', '<=', $endStr);
+ if (null !== $start) {
+ $this->query->where('transaction_journals.date', '>=', $startStr);
+ }
+ if (null !== $end) {
+ $this->query->where('transaction_journals.date', '<=', $endStr);
+ }
return $this;
}
diff --git a/config/firefly.php b/config/firefly.php
index 6689d567b0..f440871842 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -112,7 +112,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => '6.0.24',
- 'api_version' => '2.0.8',
+ 'api_version' => '2.0.9',
'db_version' => 20,
// generic settings