Skip to content

Commit

Permalink
mail history grid update
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-stanek committed Oct 18, 2023
1 parent 256bf47 commit 90458d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public function createComponentMailHistoryGrid(string $name): void
$grid->setItemsPerPageList([25, 50, 100, 250, 500]);
$grid->setStrictSessionFilterValues(false);

$grid->addColumnText('recipientUsers', 'admin.mailing.history.recipient_users', 'recipientUsersText')
->setFilterText()
->setCondition(static function (QueryBuilder $qb, string $value): void {
$qb->join('m.recipientUsers', 'u')
->andWhere('u.displayName LIKE :displayName')
->setParameter('displayName', '%' . $value . '%');
});

$grid->addColumnText('recipientRoles', 'admin.mailing.history.recipient_roles', 'recipientRolesText')
->setFilterMultiSelect($this->aclService->getRolesWithoutRolesOptions([Role::GUEST, Role::UNAPPROVED, Role::NONREGISTERED]))
->setCondition(static function (QueryBuilder $qb, ArrayHash $values): void {
Expand All @@ -65,12 +73,11 @@ public function createComponentMailHistoryGrid(string $name): void
->setParameter('sids', (array) $values);
});

$grid->addColumnText('recipientUsers', 'admin.mailing.history.recipient_users', 'recipientUsersText')
$grid->addColumnText('recipientEmails', 'admin.mailing.history.recipient_emails', 'recipientEmailsText')
->setFilterText()
->setCondition(static function (QueryBuilder $qb, string $value): void {
$qb->join('m.recipientUsers', 'u')
->andWhere('u.displayName LIKE :displayName')
->setParameter('displayName', '%' . $value . '%');
$qb->andWhere('m.recipientUsers LIKE :email')
->setParameter('email', $value);
});

$grid->addColumnText('subject', 'admin.mailing.history.subject')
Expand Down
5 changes: 5 additions & 0 deletions app/Model/Mailing/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public function setRecipientEmails(array $recipientEmails): void
$this->recipientEmails = $recipientEmails;
}

public function getRecipientEmailsText(): string
{
return implode(', ', $this->recipientEmails);
}

public function getSubject(): string
{
return $this->subject;
Expand Down

0 comments on commit 90458d9

Please sign in to comment.