Browse Source

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@522 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 years ago
parent
commit
084540c91e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      application/cmdbabstract.class.inc.php

+ 2 - 2
application/cmdbabstract.class.inc.php

@@ -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";
 							}