Refactor checkbox condition logic with new operators
- Replace legacy 'equals' and 'does_not_equal' checkbox operators with 'is_checked' and 'is_not_checked' - Update FormLogicConditionChecker in PHP and JavaScript to handle new operators - Modify open_filters.json to reflect new checkbox comparator structure - Add migration logic in ColumnCondition.vue to support legacy operator conversion - Improve checkbox condition handling with explicit true/false checks
This commit is contained in:
@@ -89,7 +89,7 @@ class FormLogicConditionChecker
|
||||
if (is_array($fieldValue)) {
|
||||
return in_array($condition['value'], $fieldValue);
|
||||
}
|
||||
return \Str::contains($fieldValue, $condition['value']);
|
||||
return \Illuminate\Support\Str::contains($fieldValue, $condition['value']);
|
||||
}
|
||||
|
||||
private function checkMatrixContains($condition, $fieldValue): bool
|
||||
@@ -362,11 +362,21 @@ class FormLogicConditionChecker
|
||||
|
||||
private function checkboxConditionMet(array $propertyCondition, $value): bool
|
||||
{
|
||||
// Treat null or missing values as false
|
||||
if ($value === null || !isset($value)) {
|
||||
$value = false;
|
||||
}
|
||||
|
||||
switch ($propertyCondition['operator']) {
|
||||
case 'is_checked':
|
||||
return $value === true;
|
||||
case 'is_not_checked':
|
||||
return $value === false;
|
||||
// Legacy operators
|
||||
case 'equals':
|
||||
return $this->checkEquals($propertyCondition, $value);
|
||||
return $value === true;
|
||||
case 'does_not_equal':
|
||||
return !$this->checkEquals($propertyCondition, $value);
|
||||
return $value === false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user