Commit e2e4b64b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Show institution student ids on institution users page

parent fbe3a7e6
......@@ -137,6 +137,9 @@ function get_institutional_admin_search_results($search, $limit) {
if ($results['count']) {
foreach ($results['data'] as &$result) {
$result['name'] = display_name($result);
if (!empty($result['studentid'])) {
$result['name'] .= ' (' . $result['studentid'] . ')';
}
}
}
return $results;
......
......@@ -382,12 +382,14 @@ class PluginSearchInternal extends PluginSearch {
$values = array($query,$query);
}
$studentid = '';
if (!is_null($institution->member)) {
$sql .= '
LEFT OUTER JOIN {usr_institution} member ON (member.usr = u.id
AND member.institution = ' . db_quote($institution->name) . ')';
$where .= '
AND ' . ($institution->member ? ' NOT ' : '') . ' member.usr IS NULL';
$studentid = ', member.studentid';
}
if (!is_null($institution->requested) || !is_null($institution->invited)) {
$sql .= '
......@@ -399,6 +401,7 @@ class PluginSearchInternal extends PluginSearch {
} else {
$where .= ' AND (req.confirmedusr = 0 OR req.confirmedusr IS NULL)';
}
$studentid = ', req.studentid';
}
if (!is_null($institution->invited)) {
if ($institution->requested == 1) {
......@@ -415,7 +418,7 @@ class PluginSearchInternal extends PluginSearch {
$data = get_records_sql_array('
SELECT
u.id, u.firstname, u.lastname, u.username, u.preferredname,
u.admin, u.staff ' . $sql . $where . '
u.admin, u.staff' . $studentid . $sql . $where . '
ORDER BY u.firstname ASC',
$values,
0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment