mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-19 08:39:06 +01:00
LSattr_html :: jsonCompositeAttribute : fix check required method
This commit is contained in:
parent
31b0b71312
commit
7a036014c6
1 changed files with 13 additions and 11 deletions
|
@ -270,24 +270,26 @@ class LSformElement_jsonCompositeAttribute extends LSformElement {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($cconf['multiple']) || !$cconf['multiple']) {
|
||||
if (count($parseValue[$c])>=1)
|
||||
$parseValue[$c] = $parseValue[$c][0];
|
||||
else
|
||||
$parseValue[$c] = '';
|
||||
}
|
||||
|
||||
if ($cconf['required'] && empty($parseValue[$c])) {
|
||||
$errors[]=getFData(_('Component %{c} must be defined'),__($cconf['label']));
|
||||
if (empty($parseValue[$c]))
|
||||
continue;
|
||||
}
|
||||
$unemptyComponents[]=$c;
|
||||
|
||||
if (!isset($cconf['multiple']) || !$cconf['multiple']) {
|
||||
$parseValue[$c] = $parseValue[$c][0];
|
||||
}
|
||||
|
||||
$unemptyComponents[]=$c;
|
||||
$value[$c]=$parseValue[$c];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($unemptyComponents)) {
|
||||
// Check required components
|
||||
foreach ($this -> components as $c => $cconf) {
|
||||
if ($cconf['required'] && !isset($value[$c])) {
|
||||
$errors[]=getFData(_('Component %{c} must be defined'),__($cconf['label']));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
foreach($errors as $e) {
|
||||
$this -> form -> setElementError($this -> attr_html,$e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue