Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28584

Emtpy Value in moodlecourse | maxsections defaults to 0 when editing a course

    XMLWordPrintable

Details

    • Bug
    • Resolution: Deferred
    • Major
    • None
    • 2.0, 2.1, 2.1.1, 2.3.3
    • Course
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_23_STABLE
    • Hide

      Go to "Site administration / Courses / Course default settings"
      Delete the value in moodlecourse | maxsections

      Show
      Go to "Site administration / Courses / Course default settings" Delete the value in moodlecourse | maxsections

    Description

      When moodlecourse | maxsections is empty it defaults to 0 when editing or creating a course, so the courses always have 0 topics/weeks after editing.

      in the lib/adminlib.php (line 3606) the value is checked and the standard is set to 52

      /** Lazy-load the available choices for the select box */
      public function load_choices() {
          $max = get_config('moodlecourse', 'maxsections');
          if (empty($max)) {
              $max = 52;
          }

      in course/edit_form.php (line 123) the value isn't checked and therfore not set to 52 if empty.

      for ($i = 0; $i <= $courseconfig->maxsections; $i++) {
      	$sectionmenu[$i] = "$i";
      }

      should check first for

      if (empty($courseconfig->maxsections)) {
          $courseconfig->maxsections = 52;
      }

      PS: Isn't there a more elegant way to set/check the defaults?

      Attachments

        Issue Links

          Activity

            People

              abgreeve Adrian Greeve
              crismiic Christoph Stadlbauer
              Votes:
              4 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: