From ee8a2e2ed9e62b1b312269d08fdbfdfb314d4529 Mon Sep 17 00:00:00 2001 From: Sara Cenni Date: Fri, 22 Jan 2016 10:16:05 +0100 Subject: [PATCH] MDL-52683 mod_scorm: Fix for Last completed attempt error with Oracle --- mod/scorm/locallib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 2ccf6183923..cc8bafd4514 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -812,8 +812,9 @@ function scorm_get_last_completed_attempt($scormid, $userid) { $sql = "SELECT MAX(attempt) FROM {scorm_scoes_track} WHERE userid = ? AND scormid = ? - AND (value='completed' OR value='passed')"; - $lastattempt = $DB->get_field_sql($sql, array($userid, $scormid)); + AND (".$DB->sql_compare_text('value')." = ".$DB->sql_compare_text('?')." OR ". + $DB->sql_compare_text('value')." = ".$DB->sql_compare_text('?').")"; + $lastattempt = $DB->get_field_sql($sql, array($userid, $scormid, 'completed', 'passed')); if (empty($lastattempt)) { return '1'; } else {