#187 Fix broken SQL on Oracle

This commit is contained in:
Mark Nelson 2018-07-12 15:16:24 +08:00
parent 54212da3d2
commit 91da92f10d

View file

@ -50,6 +50,7 @@ class email_certificate_task extends \core\task\scheduled_task {
global $DB, $PAGE;
// Get all the certificates that have requested someone get emailed.
$emailotherslengthsql = $DB->sql_length('c.emailothers');
$sql = "SELECT c.*, ct.id as templateid, ct.name as templatename, ct.contextid, co.id as courseid,
co.fullname as coursefullname, co.shortname as courseshortname
FROM {customcert} c
@ -59,7 +60,7 @@ class email_certificate_task extends \core\task\scheduled_task {
ON c.course = co.id
WHERE (c.emailstudents = :emailstudents
OR c.emailteachers = :emailteachers
OR c.emailothers != '')";
OR $emailotherslengthsql >= 3)";
if ($customcerts = $DB->get_records_sql($sql, array('emailstudents' => 1, 'emailteachers' => 1))) {
// The renderers used for sending emails.
$htmlrenderer = $PAGE->get_renderer('mod_customcert', 'email', 'htmlemail');