Skip to content

Commit c66cfbd

Browse files
author
Avikarsha Saha
committed
Merge branch 'refs/heads/MAUT-11460' into beta
2 parents 2e098fd + 8011c8b commit c66cfbd

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

EventListener/TokenSubscriber.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
571571
case 'tags':
572572
case 'select':
573573
case 'multiselect':
574-
if (!is_null($leadVal) && !is_array($leadVal)) {
574+
if (!is_array($leadVal) && !empty($leadVal)) {
575575
$leadVal = explode('|', $leadVal);
576576
}
577577
if (!is_null($filterVal) && !is_array($filterVal)) {
@@ -618,13 +618,13 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
618618
$groups[$groupNum] = !empty($leadVal);
619619
break;
620620
case 'like':
621-
$filterVal = str_replace(['.', '*', '%'], ['\.', '\*', '.*'], $filterVal);
622-
$groups[$groupNum] = 1 === preg_match('/'.$filterVal.'/', $leadVal);
621+
$matchVal = str_replace(['.', '*', '%'], ['\.', '\*', '.*'], $filterVal);
622+
$groups[$groupNum] = 1 === preg_match('/'.$matchVal.'/', $leadVal);
623623
break;
624624
case '!like':
625-
$filterVal = str_replace(['.', '*'], ['\.', '\*'], $filterVal);
626-
$filterVal = str_replace('%', '.*', $filterVal);
627-
$groups[$groupNum] = 1 !== preg_match('/'.$filterVal.'/', $leadVal);
625+
$matchVal = str_replace(['.', '*'], ['\.', '\*'], $filterVal);
626+
$matchVal = str_replace('%', '.*', $matchVal);
627+
$groups[$groupNum] = 1 !== preg_match('/'.$matchVal.'/', $leadVal);
628628
break;
629629
case OperatorOptions::IN:
630630
$groups[$groupNum] = $this->checkLeadValueIsInFilter($leadVal, $filterVal, false);

Tests/Functional/Token/EmailWithCustomObjectDynamicContentFunctionalTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ protected function setUp(): void
7272
$this->customFieldValues['nexon-multiselect'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('multiselect-test-field');
7373
$this->customFieldValues['nexon-multiselect']->setValue('option_a');
7474

75+
$this->customFieldValues['nexon-select'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('select-test-field');
76+
77+
$this->customFieldValues['nexon-url'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('url-test-field');
78+
$this->customFieldValues['nexon-url']->setValue('https://test.mautic.fr');
79+
7580
$this->customFieldValues['nexon-number'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('number-test-field');
7681
$this->customFieldValues['nexon-number']->setValue(10);
7782

@@ -101,6 +106,20 @@ protected function setUp(): void
101106
public function testDynamicContentEmail(): void
102107
{
103108
foreach ([
109+
[
110+
111+
$this->buildDynamicContentArray([
112+
['nexon-url', 'tic.f', 'like'],
113+
]),
114+
'Custom Object Dynamic Content',
115+
],
116+
[
117+
118+
$this->buildDynamicContentArray([
119+
['nexon-select', null, 'empty', 'select'],
120+
]),
121+
'Custom Object Dynamic Content',
122+
],
104123
[
105124
106125
$this->buildDynamicContentArray([

0 commit comments

Comments
 (0)