Fix broken query "created_at_before" and "updated_at_before"

This commit is contained in:
James Cole 2022-04-13 14:11:36 +02:00
parent 7b830a69d9
commit 0fea3a5a85
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 5 additions and 3 deletions

View File

@ -555,7 +555,9 @@ trait TimeCollection
*/
public function setObjectBefore(Carbon $date, string $field): GroupCollectorInterface
{
die('a');
$afterStr = $date->format('Y-m-d 00:00:00');
$this->query->where(sprintf('transaction_journals.%s', $field), '<=', $afterStr);
return $this;
}
/**

View File

@ -1374,7 +1374,7 @@ class OperatorQuerySearch implements SearchInterface
foreach ($range as $key => $value) {
switch ($key) {
default:
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateAfterParams()', $key));
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateBeforeParams()', $key));
case 'exact':
$this->collector->setObjectBefore($value, $field);
$this->operators->push(['type' => sprintf('%s_before', $field), 'value' => $value->format('Y-m-d'),]);
@ -1413,7 +1413,7 @@ class OperatorQuerySearch implements SearchInterface
foreach ($range as $key => $value) {
switch ($key) {
default:
throw new FireflyException(sprintf('Cannot handle key "%s" in setDateAfterParams()', $key));
throw new FireflyException(sprintf('Cannot handle key "%s" in setObjectDateAfterParams()', $key));
case 'exact':
$this->collector->setObjectAfter($value, $field);
$this->operators->push(['type' => sprintf('%s_after', $field), 'value' => $value->format('Y-m-d'),]);