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 = " $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 FROM {role} r
$extrajoins $extrajoins
LEFT JOIN {role_names} rn ON (rn.contextid = :coursecontext AND rn.roleid = r.id) LEFT JOIN {role_names} rn ON (rn.contextid = :coursecontext AND rn.roleid = r.id)
$extrawhere $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"; ORDER BY r.sortorder";
$roles = $DB->get_records_sql($query, $params); $roles = $DB->get_records_sql($query, $params);

View file

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