From 1d3541f785b60989af29e13999c431a66a29179e Mon Sep 17 00:00:00 2001 From: Chirag <103994754+chiragnotionforms@users.noreply.github.com> Date: Fri, 13 Jan 2023 19:17:44 +0530 Subject: [PATCH] Fix a logic check bug if value not in form param (#70) * Fix a logic check bug if value not in form param * Fix isEmpty condition checker --- app/Service/Forms/FormLogicConditionChecker.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Service/Forms/FormLogicConditionChecker.php b/app/Service/Forms/FormLogicConditionChecker.php index 14ea0dc..ba20104 100644 --- a/app/Service/Forms/FormLogicConditionChecker.php +++ b/app/Service/Forms/FormLogicConditionChecker.php @@ -23,7 +23,7 @@ class FormLogicConditionChecker // If it's not a group, just a single condition if (!isset($conditions['operatorIdentifier'])) { - return $this->propertyConditionMet($conditions['value'], $formData[$conditions['value']['property_meta']['id']]); + return $this->propertyConditionMet($conditions['value'], $formData[$conditions['value']['property_meta']['id']] ?? null); } if ($conditions['operatorIdentifier'] === 'and') { @@ -102,7 +102,7 @@ class FormLogicConditionChecker if(is_array($fieldValue)){ return count($fieldValue) === 0; } - return (!$fieldValue || $fieldValue !== '' || $fieldValue !== null); + return $fieldValue == '' || $fieldValue == null || !$fieldValue; } private function checkGreaterThan ($condition, $fieldValue): bool {