mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Fix #2589
This commit is contained in:
@@ -1162,4 +1162,40 @@ class GroupCollector implements GroupCollectorInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect transactions created on a specific date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setCreatedAt(Carbon $date): GroupCollectorInterface
|
||||
{
|
||||
$after = $date->format('Y-m-d 00:00:00');
|
||||
$before = $date->format('Y-m-d 23:59:59');
|
||||
$this->query->where('transaction_journals.created_at', '>=', $after);
|
||||
$this->query->where('transaction_journals.created_at', '<=', $before);
|
||||
Log::debug(sprintf('GroupCollector created_at is now after %s (inclusive)', $after));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect transactions updated on a specific date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setUpdatedAt(Carbon $date): GroupCollectorInterface
|
||||
{
|
||||
$after = $date->format('Y-m-d 00:00:00');
|
||||
$before = $date->format('Y-m-d 23:59:59');
|
||||
$this->query->where('transaction_journals.updated_at', '>=', $after);
|
||||
$this->query->where('transaction_journals.updated_at', '<=', $before);
|
||||
Log::debug(sprintf('GroupCollector created_at is now after %s (inclusive)', $after));
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +139,24 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function setAfter(Carbon $date): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Collect transactions created on a specific date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setCreatedAt(Carbon $date): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Collect transactions updated on a specific date.
|
||||
*
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return GroupCollectorInterface
|
||||
*/
|
||||
public function setUpdatedAt(Carbon $date): GroupCollectorInterface;
|
||||
|
||||
/**
|
||||
* Collect transactions before a specific date.
|
||||
*
|
||||
|
||||
@@ -288,6 +288,16 @@ class Search implements SearchInterface
|
||||
$after = new Carbon($modifier['value']);
|
||||
$collector->setAfter($after);
|
||||
break;
|
||||
case 'created_at':
|
||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $modifier['value']));
|
||||
$createdAt = new Carbon($modifier['value']);
|
||||
$collector->setCreatedAt($createdAt);
|
||||
break;
|
||||
case 'updated_at':
|
||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $modifier['value']));
|
||||
$updatedAt = new Carbon($modifier['value']);
|
||||
$collector->setUpdatedAt($updatedAt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$collector->setAccounts($totalAccounts);
|
||||
|
||||
Reference in New Issue
Block a user