Permalink
Browse files

MDL-38147 do not use DB->sql_length because it does not work on MSSQL

  • Loading branch information...
marinaglancy committed Mar 27, 2013
1 parent 4e53188 commit a32f163dfd26aee73d2a5f11c62cf469623e0e15
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/coursecatlib.php
View
@@ -737,7 +737,7 @@ protected static function get_course_records($whereclause, $params, $options, $c
$fields[] = 'c.summary';
$fields[] = 'c.summaryformat';
} else {
- $fields[] = $DB->sql_length('c.summary'). ' hassummary';
+ $fields[] = $DB->sql_substr('c.summary', 1, 1). ' hassummary';
}
$sql = "SELECT ". join(',', $fields). ", $ctxselect
FROM {course} c
@@ -749,6 +749,9 @@ protected static function get_course_records($whereclause, $params, $options, $c
if ($checkvisibility) {
// Loop through all records and make sure we only return the courses accessible by user.
foreach ($list as $course) {
+ if (isset($list[$course->id]->hassummary)) {
+ $list[$course->id]->hassummary = strlen($list[$course->id]->hassummary) > 0;
+ }
if (empty($course->visible)) {
// load context only if we need to check capability
context_helper::preload_from_record($course);

0 comments on commit a32f163

Please sign in to comment.