MDL-48248 enrol_manual: Ensure that the default value is always selected

This commit is contained in:
Frederic Massart
2016-05-25 10:16:59 +08:00
parent 2c952b2f38
commit b8f414c29f
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -89,6 +89,9 @@ if ($extendperiod) {
} else {
$defaultperiod = $instance->enrolperiod;
}
if (!isset($periodmenu[$defaultperiod])) {
$periodmenu[$defaultperiod] = get_string('numdays', '', floor($defaultperiod / DAYSECS));
}
if (empty($extendbase)) {
if (!$extendbase = get_config('enrol_manual', 'enrolstart')) {
// Default to now if there is no system setting.
+4
View File
@@ -237,6 +237,10 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
}
select.append(option);
}
if (!index) {
select.append(create('<option value="'+defaultvalue+'">'+durationdays.replace('{a}', defaultvalue)+'</option>'));
index = ++count;
}
select.set('selectedIndex', index);
},
getAssignableRoles : function(){