Skip to content

Commit

Permalink
Allow filtering for contactgroups in contact list
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
majentsch authored and lippserd committed Sep 29, 2015
1 parent 27e1611 commit 65a2b53
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Expand Up @@ -20,6 +20,11 @@ class ContactQuery extends IdoQuery
'instances' => array(
'instance_name' => 'i.instance_name'
),
'contactgroups' => array(
'contactgroup' => 'cgo.name1 COLLATE latin1_general_ci',
'contactgroup_name' => 'cgo.name1',
'contactgroup_alias' => 'cg.alias COLLATE latin1_general_ci'
),
'contacts' => array(
'contact_id' => 'c.contact_id',
'contact' => 'co.name1 COLLATE latin1_general_ci',
Expand Down Expand Up @@ -186,6 +191,26 @@ protected function joinServices()
);
}

/**
* Join contacts
*/
protected function joinContactgroups()
{
$this->select->joinLeft(
array('cgm' => $this->prefix . 'contactgroup_members'),
'co.object_id = cgm.contact_object_id',
array()
)->joinLeft(
array('cg' => $this->prefix . 'contactgroups'),
'cgm.contactgroup_id = cg.contactgroup_id',
array()
)->joinLeft(
array('cgo' => $this->prefix . 'objects'),
'cg.contactgroup_object_id = cgo.object_id AND cgo.is_active = 1 AND cgo.objecttype_id = 11',
array()
);
}

/**
* Join instances
*/
Expand Down
5 changes: 4 additions & 1 deletion modules/monitoring/library/Monitoring/DataView/Contact.php
Expand Up @@ -33,7 +33,10 @@ public function getColumns()
'contact_notify_host_flapping',
'contact_notify_host_downtime',
'contact_notify_host_timeperiod',
'contact_notify_service_timeperiod'
'contact_notify_service_timeperiod',
'contactgroup',
'contactgroup_name',
'contactgroup_alias'
);
}

Expand Down

0 comments on commit 65a2b53

Please sign in to comment.