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

error enrolling users if scorm modules present

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.4
    • Fix Version/s: 2.3.3
    • Component/s: SCORM
    • Labels:
    • Testing Instructions:
      Hide

      I couldn't reproduce this problem as it arises in some courses but not in other courses. It seems that the "recover grades" option has something to do with it.

      Show
      I couldn't reproduce this problem as it arises in some courses but not in other courses. It seems that the "recover grades" option has something to do with it.
    • Workaround:
      Hide

      The AJAX form calls enrol/manual/ajax.php, which (line 126) calls lib/gradelib/grade_recover_history_grades() -> lib/gradelib/grade_grab_course_grades() -> lib/gradelib/grade_update_mod_grades(). There, at last, if a SCORM module is present, the mod/scorm/lib/scorm_grade_item_update() is called and tries to create a New completion_info() without including completionlib.php.
      Workaround: use patch displayed in the Description of this issue.

      Show
      The AJAX form calls enrol/manual/ajax.php, which (line 126) calls lib/gradelib/grade_recover_history_grades() -> lib/gradelib/grade_grab_course_grades() -> lib/gradelib/grade_update_mod_grades(). There, at last, if a SCORM module is present, the mod/scorm/lib/scorm_grade_item_update() is called and tries to create a New completion_info() without including completionlib.php. Workaround: use patch displayed in the Description of this issue.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      master_MDL-35227

      Description

      In a course containing one or several SCORM module instances, if one tries to enrol users manually (from the Settings Block -> Course administration -> Users -> Enrolled users), we get a "Syntax error" Javascript modal. The error logged in the Apache error log is: PHP Fatal error: Class 'completion_info' not found in /***/mod/scorm/lib.php on line 691, referer: http://***/enrol/users.php?id=514
      The following hack fixes the issue :

      --- a/mod/scorm/lib.php
      +++ b/mod/scorm/lib.php
      @@ -688,6 +688,9 @@ function scorm_grade_item_update($scorm, $grades=null, $updatecompletion=true) {
       
               $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id);
               if (!empty($cm)) {
      +            if (!class_exists('completion_info')) { //workaround for buggy PHP versions
      +                require_once($CFG->libdir.'/completionlib.php');
      +            }
                   $completion = new completion_info($course);
                   $completion->update_state($cm, COMPLETION_COMPLETE);
               }
       

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Nov/12