Skip to content
Snippets Groups Projects
Commit 60458aa8 authored by Hendrik Donath's avatar Hendrik Donath Committed by Friederike Schwager
Browse files

Changed SQL-Statements so that they work under Standard SQL not only MySQL

parent e804cff3
Branches
Tags
No related merge requests found
......@@ -736,8 +736,7 @@ function pdfannotator_get_questions($courseid, $context, $questionfilter) {
if ($questionfilter == 1) {
$sql = $sql . ' AND NOT c.solved = 0 ';
}
$sql = $sql . "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id";
$params = array_merge([$courseid], $inparams);
$sql = $sql . "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id, a.page, a.pdfannotatorid, c.content, c.userid, c.visibility, c.timecreated, c.isdeleted, c.ishidden"; $params = array_merge([$courseid], $inparams);
$questions = $DB->get_records_sql($sql, $params);
$seehidden = has_capability('mod/pdfannotator:seehiddencomments', $context);
......@@ -827,7 +826,7 @@ function pdfannotator_get_posts_by_this_user($courseid, $context) {
. "JOIN {course_modules} cm ON p.id = cm.instance "
. "LEFT JOIN {pdfannotator_votes} v ON c.id = v.commentid "
. "WHERE c.userid = ? AND p.course = ? AND cm.id $insql "
. "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id";
. "GROUP BY a.id, p.name, p.usevotes, cm.id, c.id, c.annotationid, c.content, c.timemodified, c.ishidden, a.page, a.pdfannotatorid";
$params = array_merge([$USER->id, $courseid], $inparams);
......
......@@ -145,7 +145,9 @@ class pdfannotator_comment {
// Get the ids and text content of all comments attached to this annotation/highlight.
$sql = "SELECT c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, c.timemodified, c.modifiedby, c.solved, SUM(vote) AS votes "
. "FROM {pdfannotator_comments} c LEFT JOIN {pdfannotator_votes} v"
. " ON c.id=v.commentid WHERE annotationid = ? GROUP BY c.id ORDER BY c.timecreated";
. " ON c.id=v.commentid WHERE annotationid = ?"
. " GROUP BY c.id, c.content, c.userid, c.visibility, c.isquestion, c.isdeleted, c.ishidden, c.timecreated, c.timemodified, c.modifiedby, c.solved"
. " ORDER BY c.timecreated";
$a = array();
$a[] = $annotationid;
$comments = $DB->get_records_sql($sql, $a); // Records taken from table 'comments' as an array of objects.
......
......@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2020100800; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2020102300; // The current module version (Date: YYYYMMDDXX).
$plugin->release = 'PDF Annotator v1.4 release 4';
$plugin->requires = 2016112900; // Requires this Moodle version.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment