Merge branch 'MDL-50666-master-fix' of git://github.com/junpataleta/moodle

This commit is contained in:
Jun Pataleta 2017-12-20 15:57:17 +13:00
commit 3cdb015828
2 changed files with 3 additions and 2 deletions

View File

@ -3093,12 +3093,12 @@ function get_viewable_roles(context $context, $userid = null) {
}
$query = "
SELECT r.id, r.name, r.shortname, rn.name AS coursealias
SELECT r.id, r.name, r.shortname, rn.name AS coursealias, r.sortorder
FROM {role} r
$extrajoins
LEFT JOIN {role_names} rn ON (rn.contextid = :coursecontext AND rn.roleid = r.id)
$extrawhere
GROUP BY r.id, r.name, r.shortname, rn.name
GROUP BY r.id, r.name, r.shortname, rn.name, r.sortorder
ORDER BY r.sortorder";
$roles = $DB->get_records_sql($query, $params);

View File

@ -1086,6 +1086,7 @@
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
<KEY NAME="allowview" TYPE="foreign" FIELDS="allowview" REFTABLE="role" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="roleid-allowview" UNIQUE="true" FIELDS="roleid, allowview" COMMENT="Each pair (roleid, allowview) must appear at most once."/>