Commit fc32ee0d authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie

Fixed a bung query returning incorrect member counts when groups were

associated with more than one view
parent fbed9319
......@@ -55,7 +55,7 @@ if ($action == 'delete') {
else {
$count = get_field('usr_group', 'COUNT(*)', 'owner', $USER->get('id'));
$data = get_records_sql_array(
'SELECT g.id, g.name, COUNT(m.*) AS count, COUNT(v.*) AS hasviews FROM ' . $dbprefix . 'usr_group g INNER JOIN ' . $dbprefix . 'usr_group_member m ON m.grp=g.id LEFT OUTER JOIN ' . $dbprefix . 'view_access_group v ON (v.grp=g.id) WHERE g.owner=? GROUP BY 1, 2 ORDER BY g.name',
'SELECT g.id, g.name, COUNT(m.*) AS count, (SELECT COUNT(*) FROM ' . $dbprefix . 'view_access_group vag WHERE vag.grp=g.id) FROM ' . $dbprefix . 'usr_group g INNER JOIN ' . $dbprefix . 'usr_group_member m ON m.grp=g.id WHERE g.owner=? GROUP BY 1, 2 ORDER BY g.name',
array($USER->get('id')),
$offset,
$limit
......
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