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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Deferred
    • Affects Version/s: 2.0, 2.1, 2.1.1, 2.3.3
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_23_STABLE

      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

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              crismiic Christoph Stadlbauer
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: