diff --git a/framework/control.class.php b/framework/control.class.php index 8c5fcf895e..86416f10dd 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -638,7 +638,7 @@ class control extends baseControl if($object && empty($object->{$field->field})) $object->{$field->field} = $field->defaultValue; if(in_array($field->type, $this->config->workflowfield->numberTypes)) $field = $this->workflowfield->processNumberField($field); - $field->required = $field->readonly || ($notEmptyRule && strpos(",$field->rules,", ",{$notEmptyRule->id},") !== false); + $field->required = !$field->readonly && $notEmptyRule && strpos(",$field->rules,", ",{$notEmptyRule->id},") !== false; $field->control = $this->flow->buildFormControl($field); $field->items = $field->options ? array_filter($field->options) : null; $field->value = !empty($object->{$field->field}) ? zget($object, $field->field, '') : ''; diff --git a/lib/form/form.class.php b/lib/form/form.class.php index 667b5c034f..9eadd31e32 100644 --- a/lib/form/form.class.php +++ b/lib/form/form.class.php @@ -166,7 +166,7 @@ class form extends fixer if($field->buildin || !$field->show || !isset($layouts[$field->field])) continue; if($field->control == 'file') continue; - $required = $field->readonly || ($notEmptyRule && strpos(",$field->rules,", ",{$notEmptyRule->id},") !== false); + $required = !$field->readonly && $notEmptyRule && strpos(",$field->rules,", ",{$notEmptyRule->id},") !== false; if($field->control == 'multi-select' || $field->control == 'checkbox') { $configObject[$field->field] = array('required' => $required, 'type' => 'array', 'default' => array(''), 'filter' => 'join');