From: piers Date: Fri, 15 Aug 2008 03:30:05 +0000 (+0000) Subject: MDL-15859 [PATCH] Fixes for tests of '' on Oracle. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6280b17adb5bbe80511fec6c7bb522bbb4cd2631;p=moodle.git MDL-15859 [PATCH] Fixes for tests of '' on Oracle. --- diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 2c6e20f7a3..c7e61fed8e 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -493,7 +493,7 @@ function scorm_grade_item_update($scorm, $grades=NULL) { $params = array('itemname'=>$scorm->name, 'idnumber'=>$scorm->cmidnumber); if (($scorm->grademethod % 10) == 0) { // GRADESCOES - if ($maxgrade = $DB->count_records_select('scorm_scoes',"scorm=? AND launch<>''", array($scorm->id))) { + if ($maxgrade = $DB->count_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, ''))) { $params['gradetype'] = GRADE_TYPE_VALUE; $params['grademax'] = $maxgrade; $params['grademin'] = 0; diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php index 5f602df63e..068be1c442 100755 --- a/mod/scorm/loadSCO.php +++ b/mod/scorm/loadSCO.php @@ -40,7 +40,7 @@ if ($sco = scorm_get_sco($scoid)) { if ($sco->launch == '') { // Search for the next launchable sco - if ($scoes = $DB->get_records_select('scorm_scoes',"scorm=? AND launch<>'' AND id>?",array($scorm->id, $sco->id), 'id ASC')) { + if ($scoes = $DB->get_records_select('scorm_scoes',"scorm = ? AND launch <> ? AND id > ?",array($scorm->id, '', $sco->id), 'id ASC')) { $sco = current($scoes); } } @@ -50,7 +50,7 @@ // If no sco was found get the first of SCORM package // if (!isset($sco)) { - $scoes = $DB->get_records_select('scorm_scoes',"scorm=? AND launch<>''", array($scorm->id),'id ASC'); + $scoes = $DB->get_records_select('scorm_scoes',"scorm = ? AND launch <> ?", array($scorm->id, ''),'id ASC'); $sco = current($scoes); } diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 1e2df68e16..605a654cea 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -462,7 +462,8 @@ function scorm_count_launchable($scormid,$organization='') { $sqlorganization = " AND organization=?"; $params[] = $organization; } - return $DB->count_records_select('scorm_scoes',"scorm=$scormid $sqlorganization AND launch<>''", $params); + $params []= ''; // empty launch + return $DB->count_records_select('scorm_scoes',"scorm = ? $sqlorganization AND launch <> ?", $params); } function scorm_get_last_attempt($scormid, $userid) { @@ -617,12 +618,13 @@ function scorm_view_display ($user, $scorm, $action, $cm, $boxwidth='') { get_records_select('scorm_scoes', 'scorm=? AND launch<>\'\'', array($scorm->id)); + $scoes = $DB->get_records_select('scorm_scoes', 'scorm = ? AND launch <> ?', array($scorm->id, '')); if ($scoes && (count($scoes) == 1)) { if ($scorm->skipview >= 1) {