From 18310486ba45b8d044974f1bdd65261b35fc4b28 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 16 Dec 2024 20:30:15 +0000 Subject: [PATCH] MDL-69142 tool_cohortroles: fix table ordering by role name. --- .../classes/output/cohort_role_assignments_table.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php b/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php index 3d17017e8d0..c61d1443e53 100644 --- a/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php +++ b/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php @@ -175,7 +175,7 @@ class cohort_role_assignments_table extends table_sql { * @return array containing sql to use and an array of params. */ protected function get_sql_and_params($count = false) { - $fields = 'uca.id, uca.cohortid, uca.userid, uca.roleid, '; + $fields = 'uca.id, uca.cohortid, uca.userid, uca.roleid, r.shortname AS rolename, '; $fields .= 'c.name as cohortname, c.idnumber as cohortidnumber, c.contextid as cohortcontextid, '; $fields .= 'c.visible as cohortvisible, c.description as cohortdescription, c.theme as cohorttheme'; @@ -193,6 +193,7 @@ class cohort_role_assignments_table extends table_sql { $sql = "SELECT $select FROM {tool_cohortroles} uca JOIN {user} u ON u.id = uca.userid + JOIN {role} r ON r.id = uca.roleid JOIN {cohort} c ON c.id = uca.cohortid"; // Check if any additional filtering is required.