Moodle
  1. Moodle
  2. MDL-20336

course default settings are not propagated when admin approves course requests

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.5
    • Fix Version/s: 1.9.6, 2.0
    • Component/s: Course
    • Labels:
      None
    • Environment:
      any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      31333

      Description

      When an admin approves a requested course the default values set in Administration/Courses/Defaults courses settings such as format, number of sections, hidden sections ... are not propagated to the new course...

      This simply requires adding the following in course/pending.php near line 100, just before the insert_record statment.

      + // PP ajout defaut de la conf globale
      + $courseconfig = get_config('moodlecourse');
      + $course->format=$courseconfig->format;
      + $course->numsections=$courseconfig->numsections;
      + $course->hiddensections=$courseconfig->hiddensections;
      + $course->newsitems=$courseconfig->newsitems;
      + $course->showgrades= $courseconfig->showgrades;
      + $course->showreports=$courseconfig->showreports;
      + $course->maxbytes=$courseconfig->maxbytes;
      + // end PP
      +

        Activity

        Hide
        David Mudrak added a comment -

        Fixed in MOODLE_19_STABLE, merged into HEAD (with more defaults available). Thanks Patrick for the report and for the patch!

        Show
        David Mudrak added a comment - Fixed in MOODLE_19_STABLE, merged into HEAD (with more defaults available). Thanks Patrick for the report and for the patch!
        Hide
        Patrick Pollet added a comment -

        A cleaner and more "extensible" code would be

        // ajout defaut de la conf globale
        $courseconfig = get_config('moodlecourse');
        foreach($courseconfig as $key=>$value)

        { if (empty($course->$key)) $course->$key=$value; }

        cheers

        Show
        Patrick Pollet added a comment - A cleaner and more "extensible" code would be // ajout defaut de la conf globale $courseconfig = get_config('moodlecourse'); foreach($courseconfig as $key=>$value) { if (empty($course->$key)) $course->$key=$value; } cheers
        Hide
        Jens Eremie added a comment -

        When courses are approved there's also the timestamp missing in the databases table (postgres), which are just useful to see (query the db) how many new courses came within the period of time xy.....

        Patick, did you also see a hint for that ?

        Jens

        Show
        Jens Eremie added a comment - When courses are approved there's also the timestamp missing in the databases table (postgres), which are just useful to see (query the db) how many new courses came within the period of time xy..... Patick, did you also see a hint for that ? Jens
        Hide
        Patrick Pollet added a comment -

        I Guess one has to add

        $course->timecreated=time();

        just before the insert_record call

        David ?

        Cheers

        Show
        Patrick Pollet added a comment - I Guess one has to add $course->timecreated=time(); just before the insert_record call David ? Cheers
        Hide
        Patrick Pollet added a comment -

        or maybe replace the big chunk of code from lines 74 to 104 in course/pending.php by a simple call to the new function create_course($course), defined in couse/lib.php that takes care of all "Moodle internals" (blocks, sort order and timecreated ...)

        Cheers

        Show
        Patrick Pollet added a comment - or maybe replace the big chunk of code from lines 74 to 104 in course/pending.php by a simple call to the new function create_course($course), defined in couse/lib.php that takes care of all "Moodle internals" (blocks, sort order and timecreated ...) Cheers
        Hide
        David Mudrak added a comment -

        MOODLE_19_STABLE is frozen at the moment. I will return to this later once the patching will be available again. Thanks for the reports.

        d.

        Show
        David Mudrak added a comment - MOODLE_19_STABLE is frozen at the moment. I will return to this later once the patching will be available again. Thanks for the reports. d.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: