fixed issue when no type was preselected

This commit is contained in:
Roland Gruber 2017-12-13 11:06:57 +01:00
parent b541460231
commit 68cd9b53aa
1 changed files with 5 additions and 5 deletions

View File

@ -166,14 +166,14 @@ $typeList = array();
foreach ($types as $type) { foreach ($types as $type) {
$typeList[$type->getAlias()] = $type->getId(); $typeList[$type->getAlias()] = $type->getId();
} }
$selectedType = array(); $selectedType = null;
if (isset($_REQUEST['type'])) { if (isset($_REQUEST['type'])) {
$selectedType[] = $_REQUEST['type']; $selectedType = $_REQUEST['type'];
} }
elseif (!empty($types)) { elseif (!empty($types)) {
$selectedType[] = $types[0]->getId(); $selectedType = $types[0]->getId();
} }
$typeSelect = new htmlTableExtendedSelect('type', $typeList, $selectedType, _("Account type")); $typeSelect = new htmlTableExtendedSelect('type', $typeList, array($selectedType), _("Account type"));
$typeSelect->setHasDescriptiveElements(true); $typeSelect->setHasDescriptiveElements(true);
$typeSelect->setOnchangeEvent('changeVisibleModules(this);'); $typeSelect->setOnchangeEvent('changeVisibleModules(this);');
$table->addElement($typeSelect, true); $table->addElement($typeSelect, true);
@ -186,7 +186,7 @@ $table->addElement($moduleLabel);
$moduleGroup = new htmlGroup(); $moduleGroup = new htmlGroup();
foreach ($types as $type) { foreach ($types as $type) {
$divClasses = array('typeOptions'); $divClasses = array('typeOptions');
if ((!isset($_REQUEST['type']) && ($i != 0)) || (isset($_REQUEST['type']) && ($_REQUEST['type'] != $type->getId()))) { if ($selectedType != $type->getId()) {
$divClasses[] = 'hidden'; $divClasses[] = 'hidden';
} }
$innerTable = new htmlTable(); $innerTable = new htmlTable();