-
Bug
-
Resolution: Fixed
-
Minor
-
4.1.6, 4.2.3, 4.3
Steps to reporduce:
- Check the "Creators' role in new courses" value in the User policies admin ( /admin/settings.php?section=userpolicies) page. By default it is the 'Editing teacher'.
- Delete the 'editingteacher' role in the Manage roles admin page (/admin/roles/manage.php).
- Make a course request by any user with the right role ( Course requester role )
- Check the Courses Pending Approval page (/course/pending.php). It will now show the "Can't find data record in database table role.
Debug details:Debug info: SELECT * FROM {role} WHERE id = ?
[array (
0 => '3',
)]
Error code: invalidrecord Stack trace:
line 1658 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 1634 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 113 of /course/pending.php: call to moodle_database->get_record()
Expected behavior:
Error should point to the correct cause (something like 'The default value for the creator role is not valid, please fix it in your settings')
Event better, when deleting the role used for creatornewroleid and restorernewroleid there could be a warning to update the Creator's role value or automatically update to the closest role.
Workaround:
This is an easy to solve issue once detected:
#Check again the User policies admin page. The Creators' role in new courses option is tagged with the 'Invalid current value' warning
- Update the policies page with a valid role in the list.
- The error in the courses pending approval page is gone.