Skip to content

Commit 1799f4d

Browse files
author
Avikarsha Saha
committed
fix null case for datetime
1 parent 55bc5d4 commit 1799f4d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

EventListener/TokenSubscriber.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,13 @@ protected function matchFilterForLeadInCustomObject(array $filter, array $lead):
549549
break;
550550
case 'datetime':
551551
case 'time':
552-
$leadValCount = substr_count($leadVal, ':');
553-
$filterValCount = substr_count($filterVal, ':');
552+
if (!is_null($leadVal) && !is_null($filterVal)) {
553+
$leadValCount = substr_count($leadVal, ':');
554+
$filterValCount = substr_count($filterVal, ':');
554555

555-
if (2 === $leadValCount && 1 === $filterValCount) {
556-
$filterVal .= ':00';
556+
if (2 === $leadValCount && 1 === $filterValCount) {
557+
$filterVal .= ':00';
558+
}
557559
}
558560
break;
559561
case 'tags':

Tests/Functional/Token/EmailWithCustomObjectDynamicContentFunctionalTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ public function testDynamicContentEmail(): void
9999
{
100100
foreach ([
101101
[
102+
103+
$this->buildDynamicContentArray([
104+
['nexon-datetime', null, '!empty', 'datetime']
105+
]),
106+
'Custom Object Dynamic Content',
107+
], [
102108
103109
$this->buildDynamicContentArray([
104110
['nexon-text', 'Tata', '='],
@@ -187,7 +193,7 @@ private function buildDynamicContentArray(array $inputs): array
187193
'glue' => 'and',
188194
'field' => 'cmf_'.$this->customFieldValues[$input[0]]->getCustomField()->getId(),
189195
'object' => 'custom_object',
190-
'type' => 'text',
196+
'type' => $input[3] ?? 'text',
191197
'filter' => $input[1],
192198
'display' => $this->customObject->getName().':'.$this->customFieldValues[$input[0]]->getCustomField()->getLabel(),
193199
'operator' => $input[2],

0 commit comments

Comments
 (0)