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

Error in Courses block when the user is enrolled in courses from other servers by MNet

    Details

    • Testing Instructions:
      Hide
      1. Set up MNet enrolment
      2. Check out the greatest course ID of your local site
      3. Create enough courses on your remote site to get a greater course ID
      4. On the local site enrol a student in the remote course which has an ID that does not exist on the local site.
      5. Add the Courses block on the front page of the local site.
      6. Login as the student on the local site.
      7. Make sure you can see the block and its content without errors
      Show
      Set up MNet enrolment http://docs.moodle.org/24/en/MNet#Peer_to_Peer_Network Check out the greatest course ID of your local site Create enough courses on your remote site to get a greater course ID On the local site enrol a student in the remote course which has an ID that does not exist on the local site. Add the Courses block on the front page of the local site. Login as the student on the local site. Make sure you can see the block and its content without errors
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-40436-master
    • Story Points (Obsolete):
      5
    • Sprint:
      FRONTEND Sprint 7

      Description

      If user is enrolled in courses from other host (host 2) by mnet, and block "Courses" is activated in actual host (host 1), error shown : 'Can not find data record in database table course'.

      Steps to reproduce:

      1. Enrol user (user A) in course from other host (host 2) by mnet
      2. Activate block "Courses" in Home of host 1
      3. Access with user A in host 1

      Error shown : 'Can not find data record in database table course'.

      This is because in file:

      blocks/course_list/block_course_list.php, in function get_remote_courses()

      $coursecontext = context_course::instance($course->id);
      

      That's defined in the file :

      lib/accesslib.php

      ...
      if (!$record = $DB->get_record('context', array('contextlevel'=>CONTEXT_COURSE, 'instanceid'=>$instanceid))) {
                    if ($course = $DB->get_record('course', array('id'=>$instanceid), 'id,category', $strictness)) {
      ...
      

      but $course->id not in table 'course' because it is an MNet course.

      I think solution is commented:

      blocks/course_list/block_course_list.php, get_remote_courses()

      $coursecontext = context_course::instance($course->id);
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Jan/14