LSattr_html_select_object : Added a check of the value_attribute parameter (Cf. Bug repport #1804)

This commit is contained in:
Benjamin Renard 2010-04-26 16:33:10 +02:00
parent 3b51ec7268
commit 403698f27e

View file

@ -99,6 +99,10 @@ class LSattr_html_select_object extends LSattr_html{
if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) { if(($conf['value_attribute']=='dn')||($conf['value_attribute']=='%{dn}')) {
$val = $dn; $val = $dn;
} }
elseif (!isset($obj->attrs[$conf['value_attribute']])) {
LSerror :: addErrorCode('LSattr_html_select_object_02',$this -> name);
return;
}
else { else {
$val = $obj -> getValue($conf['value_attribute']); $val = $obj -> getValue($conf['value_attribute']);
$val = $val[0]; $val = $val[0];
@ -151,6 +155,10 @@ class LSattr_html_select_object extends LSattr_html{
} }
} }
else { else {
if (!isset($conf['value_attribute']) || (!is_array(LSconfig::get('LSobjects.'.$conf['object_type'].'.attrs.'.$conf['value_attribute'])))) {
LSerror :: addErrorCode('LSattr_html_select_object_02',$this -> name);
return;
}
$filters=array(); $filters=array();
foreach($values as $val) { foreach($values as $val) {
if (!empty($val)) { if (!empty($val)) {
@ -203,5 +211,8 @@ class LSattr_html_select_object extends LSattr_html{
LSerror :: defineError('LSattr_html_select_object_01', LSerror :: defineError('LSattr_html_select_object_01',
_("LSattr_html_select_object : LSobject type is undefined (attribute : %{attr}).") _("LSattr_html_select_object : LSobject type is undefined (attribute : %{attr}).")
); );
LSerror :: defineError('LSattr_html_select_object_02',
_("LSattr_html_select_object : the value of the parameter value_attribute in the configuration of the attribute %{attrs} is incorrect. This attribute does not exists.")
);
?> ?>