LSldapObject : fix regression introduced by commit 274ccad0

Handle all attributes in validateAttrsData() method but don't blame
  on missing required attribute on non-create form and if attibute is
  not present in form (or freezed).
This commit is contained in:
Benjamin Renard 2019-02-28 15:24:37 +01:00
parent 1dec2cc4f6
commit 98ffc081c9

View file

@ -404,8 +404,6 @@ class LSldapObject {
$LSform=false; $LSform=false;
} }
foreach($this -> attrs as $attr_name => $attr) { foreach($this -> attrs as $attr_name => $attr) {
if ($LSform && (!$LSform -> hasElement($attr_name) || $LSform -> isFreeze($attr_name)))
continue;
$attr_values = $attr -> getValue(); $attr_values = $attr -> getValue();
if (!$attr -> isValidate()) { if (!$attr -> isValidate()) {
if($attr -> isUpdate()) { if($attr -> isUpdate()) {
@ -427,6 +425,10 @@ class LSldapObject {
} }
} }
else { else {
// Don't blame on non-create form for attributes not-present in form (or freezed)
if ($LSform && $idFrom != 'create' && (!$LSform -> hasElement($attr_name) || $LSform -> isFreeze($attr_name)))
continue;
LSerror :: addErrorCode('LSattribute_06',$attr -> getLabel()); LSerror :: addErrorCode('LSattribute_06',$attr -> getLabel());
$retval = false; $retval = false;
} }