From d49e53b39fd36dbc550ce8d9b64ee52e2e2c228e Mon Sep 17 00:00:00 2001 From: Gareth J Barnard Date: Tue, 4 Jun 2013 00:07:46 +0100 Subject: [PATCH] MDL-39764 course_format: Allow courses to have numsections > maxsections. --- course/edit_form.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/course/edit_form.php b/course/edit_form.php index 7d22c94ef22..52db0995819 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -130,6 +130,16 @@ class course_edit_form extends moodleform { if (!isset($max) || !is_numeric($max)) { $max = 52; } + /* + * Increase the number of sections combo box values if the user has increased the number of sections + * using the icon on the course page beyond course 'maxsections' or course 'maxsections' has been + * reduced below the number of sections already set for the course on the site administration course + * defaults page. This is so that the number of sections is not reduced leaving unintended orphaned + * activities / resources. + */ + if (isset($course->numsections) && $course->numsections > $max) { + $max = $course->numsections; + } for ($i = 0; $i <= $max; $i++) { $sectionmenu[$i] = "$i"; }