Skip to content

Commit

Permalink
Fix a logic check bug if value not in form param (JhumanJ#70)
Browse files Browse the repository at this point in the history
* Fix a logic check bug if value not in form param

* Fix isEmpty condition checker
  • Loading branch information
chiragnotionforms authored Jan 13, 2023
1 parent ee6956a commit 1d3541f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Service/Forms/FormLogicConditionChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private function conditionsAreMet(?array $conditions, array $formData): bool {

// 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') {
Expand Down Expand Up @@ -102,7 +102,7 @@ private function checkIsEmpty ($condition, $fieldValue): bool {
if(is_array($fieldValue)){
return count($fieldValue) === 0;
}
return (!$fieldValue || $fieldValue !== '' || $fieldValue !== null);
return $fieldValue == '' || $fieldValue == null || !$fieldValue;
}

private function checkGreaterThan ($condition, $fieldValue): bool {
Expand Down

0 comments on commit 1d3541f

Please sign in to comment.