Skip to content

Commit

Permalink
Merge branch 'refs/heads/MAUT-11460' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Avikarsha Saha committed Jul 17, 2024
2 parents 2e098fd + 8011c8b commit c66cfbd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 6 additions & 6 deletions EventListener/TokenSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
case 'tags':
case 'select':
case 'multiselect':
if (!is_null($leadVal) && !is_array($leadVal)) {
if (!is_array($leadVal) && !empty($leadVal)) {
$leadVal = explode('|', $leadVal);
}
if (!is_null($filterVal) && !is_array($filterVal)) {
Expand Down Expand Up @@ -618,13 +618,13 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
$groups[$groupNum] = !empty($leadVal);
break;
case 'like':
$filterVal = str_replace(['.', '*', '%'], ['\.', '\*', '.*'], $filterVal);
$groups[$groupNum] = 1 === preg_match('/'.$filterVal.'/', $leadVal);
$matchVal = str_replace(['.', '*', '%'], ['\.', '\*', '.*'], $filterVal);
$groups[$groupNum] = 1 === preg_match('/'.$matchVal.'/', $leadVal);
break;
case '!like':
$filterVal = str_replace(['.', '*'], ['\.', '\*'], $filterVal);
$filterVal = str_replace('%', '.*', $filterVal);
$groups[$groupNum] = 1 !== preg_match('/'.$filterVal.'/', $leadVal);
$matchVal = str_replace(['.', '*'], ['\.', '\*'], $filterVal);
$matchVal = str_replace('%', '.*', $matchVal);
$groups[$groupNum] = 1 !== preg_match('/'.$matchVal.'/', $leadVal);
break;
case OperatorOptions::IN:
$groups[$groupNum] = $this->checkLeadValueIsInFilter($leadVal, $filterVal, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ protected function setUp(): void
$this->customFieldValues['nexon-multiselect'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('multiselect-test-field');
$this->customFieldValues['nexon-multiselect']->setValue('option_a');

$this->customFieldValues['nexon-select'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('select-test-field');

$this->customFieldValues['nexon-url'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('url-test-field');
$this->customFieldValues['nexon-url']->setValue('https://test.mautic.fr');

$this->customFieldValues['nexon-number'] = $this->customItems['nexon']->findCustomFieldValueForFieldAlias('number-test-field');
$this->customFieldValues['nexon-number']->setValue(10);

Expand Down Expand Up @@ -101,6 +106,20 @@ protected function setUp(): void
public function testDynamicContentEmail(): void
{
foreach ([
[
'[email protected]',
$this->buildDynamicContentArray([
['nexon-url', 'tic.f', 'like'],
]),
'Custom Object Dynamic Content',
],
[
'[email protected]',
$this->buildDynamicContentArray([
['nexon-select', null, 'empty', 'select'],
]),
'Custom Object Dynamic Content',
],
[
'[email protected]',
$this->buildDynamicContentArray([
Expand Down

0 comments on commit c66cfbd

Please sign in to comment.