Skip to content

Commit

Permalink
Updating the filter criteria as per filter
Browse files Browse the repository at this point in the history
  • Loading branch information
shinde-rahul committed Sep 29, 2023
1 parent 468238b commit 504c3a5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions EventListener/LeadSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,18 @@ public function onListFiltering(LeadListFilteringEvent $event)

if (in_array($currentFilter, $eventFilters, true)) {
$eventNames = $details['filter'];
preg_match('#^([^ ]+ +[^ ]+) +(.*)$#', $eventNames, $matches);
$eventNames = $this->model->getIdByNameAndDate($matches[2], $matches[1]);
if (!$eventNames) {
break;

$isAnyEvent = in_array($eventNames, ['any', $this->translator->trans('plugin.citrix.event.'.$product.'.any')], true);
$productId = 0;
if (!$isAnyEvent) {
preg_match('#^([^ ]+ +[^ ]+) +(.*)$#', $eventNames, $matches);
$productId = $this->model->getIdByNameAndDate($matches[2], $matches[1]);

if (!$productId) {
break;
}
}
$isAnyEvent = in_array('any', $eventNames, true);

$subQueriesSQL = [];

$eventTypes = [GoToEventTypes::REGISTERED, GoToEventTypes::ATTENDED];
Expand All @@ -287,7 +293,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()->eq($alias.$k.'.citrix_product_id', $productId),
$q->expr()->eq($alias.$k.'.contact_id', 'l.id')
)
);
Expand Down

0 comments on commit 504c3a5

Please sign in to comment.