James Cole
2023-09-19 07:31:12 +02:00
parent edbac66576
commit 549f3c038a
3 changed files with 16 additions and 10 deletions

View File

@@ -80,7 +80,7 @@ class ShowController extends Controller
->setPage($this->parameters->get('page')) ->setPage($this->parameters->get('page'))
// set types of transactions to return. // set types of transactions to return.
->setTypes($types); ->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')); $collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
} }
$paginator = $collector->getPaginatedGroups(); $paginator = $collector->getPaginatedGroups();

View File

@@ -819,22 +819,28 @@ trait TimeCollection
/** /**
* Set the start and end time of the results to return. * Set the start and end time of the results to return.
* *
* @param Carbon $start * Can either or both be NULL
* @param Carbon $end *
* @param Carbon|null $start
* @param Carbon|null $end
* *
* @return GroupCollectorInterface * @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]; [$start, $end] = [$end, $start];
} }
// always got to end of day / start of day for ranges. // always got to end of day / start of day for ranges.
$startStr = $start->format('Y-m-d 00:00:00'); $startStr = $start?->format('Y-m-d 00:00:00');
$endStr = $end->format('Y-m-d 23:59:59'); $endStr = $end?->format('Y-m-d 23:59:59');
$this->query->where('transaction_journals.date', '>=', $startStr); if (null !== $start) {
$this->query->where('transaction_journals.date', '<=', $endStr); $this->query->where('transaction_journals.date', '>=', $startStr);
}
if (null !== $end) {
$this->query->where('transaction_journals.date', '<=', $endStr);
}
return $this; return $this;
} }

View File

@@ -112,7 +112,7 @@ return [
// see cer.php for exchange rates feature flag. // see cer.php for exchange rates feature flag.
], ],
'version' => '6.0.24', 'version' => '6.0.24',
'api_version' => '2.0.8', 'api_version' => '2.0.9',
'db_version' => 20, 'db_version' => 20,
// generic settings // generic settings