MDL-61556 Questions: Fixed moving question categories between contexts

This commit is contained in:
Shamim Rezaie
2018-03-03 16:31:59 +11:00
parent 856e07e4e7
commit ee1052bd18
+5 -1
View File
@@ -76,8 +76,12 @@ if ($param->moveupcontext || $param->movedowncontext) {
} else {
$catid = $param->movedowncontext;
}
$newtopcat = question_get_top_category($param->tocontext);
if (!$newtopcat) {
print_error('invalidcontext');
}
$oldcat = $DB->get_record('question_categories', array('id' => $catid), '*', MUST_EXIST);
$qcobject->update_category($catid, '0,'.$param->tocontext, $oldcat->name, $oldcat->info);
$qcobject->update_category($catid, "{$newtopcat->id},{$param->tocontext}", $oldcat->name, $oldcat->info);
// The previous line does a redirect().
}