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

Course completion role criteria causes fatal error

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Normal testing

      1. Enable completion tracking and Enable conditional access [Site administration ► Advanced features].
      2. Create a new course. Make sure that completion tracking is enabled.
      3. Create some activities and set up requirements for completion.
      4. Create two roles with the capability moodle/course:markcomplete.
        1. [Site administration ► Users ► Permissions ► Define roles]
        2. Use a 'Teacher' archetype / role.
        3. Check that moodle/course:markcomplete is set to Allow.
      5. Go to the course and check out 'Course completion' [Courses ► Miscellaneous ► {your course}

        ► Course completion].

      6. Expand 'Condition: Manual completion by others' and check the boxes next to the roles that you created.
      7. Add the Course Completion Status block.
      8. Enrol yourself as a student.
      9. Confirm the course completion status block shows your status in conditions
      10. Make a backup of the course without user data.
      11. Restore the backup of the course into a new course.
      12. Enrol students into the backed up course.
      13. Log in as a student.
      14. Try to view the course.

      Old behaviour:
      Completion status block and completion report throw errors

      New behaviour:
      They don't! Confirm by checking in the new course's completion settings that the role you added in the original course is still checked.

      Bonus:

      1. Restore backup on a different Moodle install and confirm working.
      2. Between backing up and restoring, delete the two roles you created, recreating new roles with the same shortnames. Check the restore and course block still work and now point to the new roles.

      Regression testing

      1. Create a backup file before this patch has been implemented.
      2. Restore the file after the patch has been implemented and check for errors.
      Show
      Normal testing Enable completion tracking and Enable conditional access [Site administration ► Advanced features] . Create a new course. Make sure that completion tracking is enabled. Create some activities and set up requirements for completion. Create two roles with the capability moodle/course:markcomplete. [Site administration ► Users ► Permissions ► Define roles] Use a 'Teacher' archetype / role. Check that moodle/course:markcomplete is set to Allow. Go to the course and check out 'Course completion' [Courses ► Miscellaneous ► {your course} ► Course completion]. Expand 'Condition: Manual completion by others' and check the boxes next to the roles that you created. Add the Course Completion Status block. Enrol yourself as a student. Confirm the course completion status block shows your status in conditions Make a backup of the course without user data. Restore the backup of the course into a new course. Enrol students into the backed up course. Log in as a student. Try to view the course. Old behaviour: Completion status block and completion report throw errors New behaviour: They don't! Confirm by checking in the new course's completion settings that the role you added in the original course is still checked. Bonus: Restore backup on a different Moodle install and confirm working. Between backing up and restoring, delete the two roles you created, recreating new roles with the same shortnames. Check the restore and course block still work and now point to the new roles. Regression testing Create a backup file before this patch has been implemented. Restore the file after the patch has been implemented and check for errors.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-40097-master
    • Sprint:
      BACKEND Sprint 19
    • Issue size:
      Small

      Description

      Hi there,

      I'm using Moodle 2.4 on a test site.

      I've got a large course with many activities with completion criteria set. I'm using the Flexible Sections course format to structure things.

      When I added the Course Completion block to the course I started getting the error:

      Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

      I was able to turn on debugging and have identified the course completion block as the issue. When it's disabled the error goes.

      Here's the debug info:

      Debug info: Argument 1 passed to role_get_name() must be an instance of stdClass, boolean given, called in [dirroot]/completion/criteria/completion_criteria_role.php on line 126 and defined
      Error code: codingerror
      Stack trace:
      line 406 of /lib/setuplib.php: coding_exception thrown
      line 4458 of /lib/accesslib.php: call to default_error_handler()
      line 126 of /completion/criteria/completion_criteria_role.php: call to role_get_name()
      line 141 of /blocks/completionstatus/block_completionstatus.php: call to completion_criteria_role->get_title()
      line 284 of /blocks/moodleblock.class.php: call to block_completionstatus->get_content()
      line 232 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
      line 953 of /lib/blocklib.php: call to block_base->get_content_for_output()
      line 1005 of /lib/blocklib.php: call to block_manager->create_block_contents()
      line 353 of /lib/blocklib.php: call to block_manager->ensure_content_created()
      line 34 of /theme/standardtotara/layout/general.php: call to block_manager->region_has_content()
      line 806 of /lib/outputrenderers.php: call to include()
      line 734 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
      line 240 of /course/view.php: call to core_renderer->header()

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                21 Vote for this issue
                Watchers:
                23 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Jan/15