- Default value for a drop-down list is not forced if the field is not mandatory

SVN:trunk[522]
This commit is contained in:
Denis Flaven
2010-07-01 14:41:33 +00:00
parent 9487a54bc1
commit 4531570070

View File

@@ -972,14 +972,14 @@ abstract class cmdbAbstractObject extends CMDBObject
$sHTMLValue .= "<option value=\"0\">".Dict::S('UI:SelectOne')."</option>\n";
foreach($aAllowedValues as $key => $display_value)
{
if (count($aAllowedValues) == 1)
if ((count($aAllowedValues) == 1) && $bMandatory )
{
// When there is only once choice, select it by default
$sSelected = ' selected';
}
else
{
$sSelected = ($value == $key) ? ' selected' : '';
$sSelected = ($value == $key) ? ' selected' : '';
}
$sHTMLValue .= "<option value=\"$key\"$sSelected>$display_value</option>\n";
}