Skip to content

Commit

Permalink
Updated the query to be able to get the correct ids
Browse files Browse the repository at this point in the history
  • Loading branch information
shinde-rahul committed Sep 15, 2023
1 parent 101bc69 commit 36d95ae
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions EventListener/LeadSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,21 @@ public function onListFiltering(LeadListFilteringEvent $event)
$eventFilters = [$product.'-registration', $product.'-attendance', $product.'-no-attendance'];

if (in_array($currentFilter, $eventFilters, true)) {
$eventNames = $details['filter'];
$eventNameFilter = $details['filter'];

$isAnyEvent = in_array('any', $eventNames, true);
$isAnyEvent = in_array('any', $eventNameFilter, true);
if (!$isAnyEvent) {
preg_match('#^([^ ]+ +[^ ]+) +(.*)$#', $eventNames, $matches);
$eventNames = $this->model->getIdByNameAndDate($matches[2], $matches[1]);
$eventIds = [];
foreach ($eventNameFilter as $filter) {
preg_match('#^([^ ]+ +[^ ]+) +(.*)$#', $filter, $matches);

if (!$eventNames) {
$id = $this->model->getIdByNameAndDate($matches[2], $matches[1]);
if ($id) {
$eventIds[] = $id;
}
}

if (empty($eventIds)) {
break;
}
}
Expand All @@ -292,7 +299,7 @@ public function onListFiltering(LeadListFilteringEvent $event)
$query->where(
$q->expr()->andX(
$q->expr()->eq($alias.$k.'.event_type', $q->expr()->literal($eventType)),
$q->expr()->eq($alias.$k.'.citrix_product_id', $eventNames),
$q->expr()->in($alias.$k.'.citrix_product_id', $eventIds),
$q->expr()->eq($alias.$k.'.contact_id', 'l.id')
)
);
Expand Down

0 comments on commit 36d95ae

Please sign in to comment.