MDL-13399 prevent ambiguous column names in get_my_courses; merged from MOODLE_19_STABLE

This commit is contained in:
skodak
2008-02-18 20:14:16 +00:00
parent 47ab6f83bb
commit 7007049315
+10
View File
@@ -832,6 +832,16 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
$orderby = '';
$sort = trim($sort);
if (!empty($sort)) {
$rawsorts = explode(',', $sort);
$sorts = array();
foreach ($rawsorts as $rawsort) {
$rawsort = trim($rawsort);
if (strpos('c.', $rawsort)) {
$rawsort = substr($rawsort, 2);
}
$sorts[] = trim($rawsort);
}
$sort = 'c.'.implode(',c.', $sorts);
$orderby = "ORDER BY $sort";
}