Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3677

Courses without LMB enrollment method cause errors on enrollment processing


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 2.1.3
    • Enrol: Banner/LMB

      Courses on a client's site were created without the LMB enrollment method. This causes errors with the LMB plugin when enrollments are processed.

      Root cause: The LMB enrollment method is added to the course at the final step of the "create course shell" function. If there is an error creating the enrollment method OR if the course was not created via the LMB plugin, the state is now unrecoverable because the enrollment method is not added to the course in subsequent processing.

      Solution: The "process enrollments" function should check to see if the LMB enrollment method exists in the course, adding it if it does not.

      Workaround (query to fix missing enrollment methods):

      INSERT INT mdl_enrol (enrol, status, courseid, enrolstartdate, enrolenddate, timemodified, timecreated, sortorder)
      'lmb' AS enrol
      , 0 AS status
      , c.id AS courseid
      , 0 AS enrolstartdate
      , 0 AS enrolenddate
      , UNIX_TIMESTAMP(NOW()) AS timemodified
      , UNIX_TIMESTAMP(NOW()) AS timecreated
      , t.sortorder
      FROM mdl_course c
      LEFT JOIN mdl_enrol e
      ON (c.id = e.courseid AND e.enrol = 'lmb')
      LEFT JOIN (SELECT courseid, (COALESCE(MAX(sortorder), -1) + 1) AS sortorder FROM mdl_enrol GROUP BY courseid) t
      ON (c.id = t.courseid)
      WHERE e.id IS NULL
      AND c.format != 'site'

            emerrill Eric Merrill
            cfollin Chris Follin
            1 Vote for this issue
            1 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.