* [bug #67757] enhance search form handling by introducing condition for zero values. Update default data assignment to replace '0' with 'ZERO' for specific fields.

This commit is contained in:
sunhao
2025-12-09 14:30:05 +08:00
parent 6d8b74b887
commit 96e29b2aae
+9 -2
View File
@@ -6,7 +6,8 @@ $operators = array();
foreach($lang->search->operators as $value => $text) $operators[] = array('value' => $value, 'text' => $text);
/* Build conditions. */
$conditions = array();
$conditions = array();
$conditionHasZeroValue = array();
foreach($fieldParams as $name => $param)
{
if(!isset($fields[$name])) continue;
@@ -38,6 +39,7 @@ foreach($fieldParams as $name => $param)
{
if(empty($text)) continue;
$condition->items[] = array('value' => $value, 'text' => $text);
if($value === 'ZERO') $conditionHasZeroValue[] = $name;
}
}
@@ -65,7 +67,12 @@ if(is_array($formSession))
$defaultData['field' . $index] = $item['field'];
if(isset($item['operator'])) $defaultData['operator' . $index] = $item['operator'];
if(isset($item['andOr'])) $defaultData['andOr' . $index] = $item['andOr'];
if(isset($item['value'])) $defaultData['value' . $index] = $item['value'];
if(isset($item['value']))
{
if($item['value'] === '0' && in_array($item['field'], $conditionHasZeroValue)) $item['value'] = 'ZERO';
$defaultData['value' . $index] = $item['value'];
}
}
$index++;
}