Commit 3a45fcd3 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1795273: delete lti submission when deleting a page

When a user is to be deleted, the LTI submission needs to be removed
for the system to delete the user properly.

behatnotneeded

Change-Id: Ibc9ca94c85f2fd668772801b9bb85370151304f4
parent 0f603d9e
......@@ -153,6 +153,9 @@ class Collection {
delete_records('collection_view','collection',$this->id);
delete_records('tag', 'resourcetype', 'collection', 'resourceid', $this->id);
if (is_plugin_active('lti', 'module')) {
delete_records('lti_assessment_submission', 'collectionid', $this->id);
}
delete_records('collection','id',$this->id);
delete_records('existingcopy', 'collection', $this->id);
......
......@@ -945,6 +945,14 @@ function group_delete($groupid, $shortname=null, $institution=null, $notifymembe
$forum->delete();
}
// Delete lti submissions to the group if they exist
if (is_plugin_active('lti', 'module')) {
foreach (get_column('lti_assessment', 'id', 'group', $group->id) as $assessmentid) {
delete_records('lti_assessment_submission', 'ltiassessment', $assessmentid);
}
delete_records('lti_assessment', 'group', $group->id);
}
if ($notifymembers) {
require_once('activity.php');
activity_occurred('groupmessage', array(
......
......@@ -1013,6 +1013,9 @@ class View {
handle_event('deleteview', $eventdata);
delete_records('view_rows_columns', 'view', $this->id);
if (is_plugin_active('lti', 'module')) {
delete_records('lti_assessment_submission', 'viewid', $this->id);
}
delete_records('view','id',$this->id);
if (!empty($this->owner) && $this->is_submitted()) {
// There should be no way to delete a submitted view,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment