Commit 929a082a authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie

Prevent the odd error that occurs when no users are returned from search

(seen on production, actually unreproducible
parent 81343758
......@@ -105,19 +105,24 @@ class PluginSearchInternal extends PluginSearch {
$offset,
$limit);
$userlist = '('.join(',', array_map(create_function('$u','return $u->id;'), $users)).')';
if ($users) {
$userlist = '('.join(',', array_map(create_function('$u','return $u->id;'), $users)).')';
$data = get_records_sql_array('
SELECT
u.id, a.artefacttype, a.title
FROM
' . $prefix . 'artefact a
INNER JOIN ' . $prefix . 'usr u ON u.id = a.owner
WHERE
a.artefacttype IN ' . $fieldlist . '
AND u.id IN ' . $userlist . '
ORDER BY u.firstname, u.lastname, u.id, a.artefacttype',
array());
$data = get_records_sql_array('
SELECT
u.id, a.artefacttype, a.title
FROM
' . $prefix . 'artefact a
INNER JOIN ' . $prefix . 'usr u ON u.id = a.owner
WHERE
a.artefacttype IN ' . $fieldlist . '
AND u.id IN ' . $userlist . '
ORDER BY u.firstname, u.lastname, u.id, a.artefacttype',
array());
}
else {
$data = false;
}
if (!empty($data)) {
foreach ($users as &$user) {
......
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