Skip to content

Commit

Permalink
Fix filter set for MailLogQueryBuilder in MailReceivedCriteria
Browse files Browse the repository at this point in the history
- `MailLogQueryBuilder->setFilter()` accepts as parameters two DateTimes
  (from and to).
- `MailReceivedCriteria` set array (with both from & to DateTimes) within
  single (from) parameter.

remp/crm#3263
  • Loading branch information
markoph committed Aug 9, 2024
1 parent a80e18d commit be37c9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Models/Api/MailLogQueryBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Crm\RempMailerModule\Models\Api;

use Nette\Utils\DateTime;
Expand Down
6 changes: 5 additions & 1 deletion src/Scenarios/MailReceivedCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ public function addConditions(Selection $selection, array $paramValues, ActiveRo
$logQuery = new MailLogQueryBuilder();
$logQuery->setEmail($criterionItemRow->email)
->setMailTemplateCodes($templateCodes)
->setFilter('delivered_at', $deliveredAtTimeFilter)
->setFilter(
'delivered_at',
$deliveredAtTimeFilter['from'] ?? null,
$deliveredAtTimeFilter['to'] ?? null,
)
->setPage(1);

$result = $this->mailLogsRepository->get($logQuery);
Expand Down

0 comments on commit be37c9e

Please sign in to comment.