Fix contact group member count

fixes #2837
This commit is contained in:
Eric Lippmann 2017-10-05 14:35:15 +02:00
parent d11775a6b8
commit 8de0b80f9e
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class ContactgroupQuery extends IdoQuery
'contactgroup_alias' => 'cg.alias COLLATE latin1_general_ci' 'contactgroup_alias' => 'cg.alias COLLATE latin1_general_ci'
), ),
'members' => array( 'members' => array(
'contact_count' => 'COUNT(cgm.contactgroup_member_id)' 'contact_count' => 'SUM(CASE WHEN cgmo.object_id IS NOT NULL THEN 1 ELSE 0 END)'
), ),
'hostgroups' => array( 'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
@ -88,8 +88,8 @@ class ContactgroupQuery extends IdoQuery
'cgm.contactgroup_id = cg.contactgroup_id', 'cgm.contactgroup_id = cg.contactgroup_id',
array() array()
)->joinLeft( )->joinLeft(
array('co' => $this->prefix . 'objects'), array('cgmo' => $this->prefix . 'objects'),
'co.object_id = cgm.contact_object_id AND co.is_active = 1 AND co.objecttype_id = 10', 'cgmo.object_id = cgm.contact_object_id AND cgmo.is_active = 1 AND cgmo.objecttype_id = 10',
array() array()
); );
} }