MDL-13399 prevent ambiguous column names in get_my_courses; merged from MOODLE_19_STABLE
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user