streamingltd / MEDIAL-Moodle-Activity

The MEDIAL activity plugin for Moodle
GNU General Public License v3.0
3 stars 8 forks source link

Error in Default activity completion #15

Open opitz opened 9 months ago

opitz commented 9 months ago

When trying to use Defailt activity completion with Moodle 4.3 the following error occurs:

Can't find data record in database.

Debug info: SELECT cm.*, m.name, md.name AS modname
FROM {course_modules} cm
JOIN {modules} md ON md.id = cm.module
JOIN {helixmedia} m ON m.id = cm.instance

WHERE cm.id = :cmid AND md.name = :modulename

[array (
'cmid' => NULL,
'modulename' => 'helixmedia',
)]
Error code: invalidrecordunknown

Stack trace:
line 1686 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 1283 of /lib/datalib.php: call to moodle_database->get_record_sql()
line 128 of /mod/helixmedia/lib.php: call to get_coursemodule_from_id()
line 42 of /mod/helixmedia/mod_form.php: call to helixmedia_get_preid()
line 217 of /lib/formslib.php: call to mod_helixmedia_mod_form->definition()
line 127 of /course/moodleform_mod.php: call to moodleform->__construct()
line 96 of /completion/classes/defaultedit_form.php: call to moodleform_mod->__construct()
line 120 of /completion/classes/defaultedit_form.php: call to core_completion_defaultedit_form->get_module_form()
line 217 of /lib/formslib.php: call to core_completion_defaultedit_form->definition()
line 45 of /completion/classes/defaultedit_form.php: call to moodleform->__construct()
line 89 of /course/classes/output/bulk_activity_completion_renderer.php: call to core_completion_defaultedit_form->__construct()
line 97 of /course/defaultcompletion.php: call to core_course_bulk_activity_completion_renderer->defaultcompletion()

I believe the issue is rooted in the definition of a global variable "$update" in mod_form.php which is never declared and therefore will be set to NULL and will not result in a record from the database query which is declared MUST_EXIST on line 128 of lib.php?!