Commit 4a62ea43 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Sort user search results by firstname, lastname

parent 0f3865d4
...@@ -92,7 +92,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -92,7 +92,7 @@ class PluginSearchInternal extends PluginSearch {
if ($count > 0) { if ($count > 0) {
$users = get_records_sql_assoc(' $users = get_records_sql_assoc('
SELECT DISTINCT ON (u.preferredname, u.lastname, u.firstname, u.id) SELECT DISTINCT ON (u.firstname, u.lastname, u.id)
u.id, u.username, u.institution, u.firstname, u.lastname, u.preferredname u.id, u.username, u.institution, u.firstname, u.lastname, u.preferredname
FROM ' . $prefix . 'artefact a FROM ' . $prefix . 'artefact a
INNER JOIN ' . $prefix .'usr u ON u.id = a.owner INNER JOIN ' . $prefix .'usr u ON u.id = a.owner
...@@ -100,7 +100,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -100,7 +100,7 @@ class PluginSearchInternal extends PluginSearch {
u.id <> 0 u.id <> 0
AND a.artefacttype IN ' . $fieldlist . " AND a.artefacttype IN ' . $fieldlist . "
AND (a.title ILIKE '%' || ? || '%') AND (a.title ILIKE '%' || ? || '%')
ORDER BY u.preferredname, u.lastname, u.firstname, u.id", ORDER BY u.firstname, u.lastname, u.id",
array($query_string), array($query_string),
$offset, $offset,
$limit); $limit);
...@@ -116,7 +116,7 @@ class PluginSearchInternal extends PluginSearch { ...@@ -116,7 +116,7 @@ class PluginSearchInternal extends PluginSearch {
WHERE WHERE
a.artefacttype IN ' . $fieldlist . ' a.artefacttype IN ' . $fieldlist . '
AND u.id IN ' . $userlist . ' AND u.id IN ' . $userlist . '
ORDER BY u.preferredname, u.lastname, u.firstname, u.id, a.artefacttype', ORDER BY u.firstname, u.lastname, u.id, a.artefacttype',
array()); array());
if (!empty($data)) { if (!empty($data)) {
......
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