- LSattr_html_select_object : Correction d'un bug dans la méthode getValue()

- Lattribute : Correction d'un bug dans la méthode getFormVal()
This commit is contained in:
Benjamin Renard 2008-10-06 14:53:32 +00:00
parent 7560e44586
commit 596aa41434
2 changed files with 15 additions and 7 deletions

View file

@ -91,7 +91,7 @@ class LSattr_html_select_object extends LSattr_html{
return; return;
} }
if (is_array($values)) { if ((is_array($values))&&(!empty($values))) {
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) { if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
$list=array(); $list=array();
foreach($values as $dn) { foreach($values as $dn) {
@ -102,14 +102,21 @@ class LSattr_html_select_object extends LSattr_html{
} }
} }
else { else {
$filter='(|'; $filter='';
foreach($values as $val) { foreach($values as $val) {
if (!empty($val)) {
$filter.='('.$conf['value_attribute'].'='.$val.')'; $filter.='('.$conf['value_attribute'].'='.$val.')';
} }
$filter.=')'; }
if ($filter!='') {
$filter='(|'.$filter.')';
$obj = new $conf['object_type'](); $obj = new $conf['object_type']();
$list = $obj -> listObjects($filter); $list = $obj -> listObjects($filter);
} }
else {
$list=array();
}
}
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) { if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
for($i=0;$i<count($list);$i++) { for($i=0;$i<count($list);$i++) {
$retInfos[$list[$i] -> dn]=$list[$i] -> getDisplayValue($conf['display_attribute']); $retInfos[$list[$i] -> dn]=$list[$i] -> getDisplayValue($conf['display_attribute']);

View file

@ -338,8 +338,9 @@ class LSattribute {
*/ */
function getFormVal() { function getFormVal() {
$data=$this -> getDisplayValue(); $data=$this -> getDisplayValue();
if(!is_array($data)) if((!is_array($data))&&($data!=NULL)) {
$data=array($data); $data=array($data);
}
return $data; return $data;
} }