From 77fe09487031dd8119610130042c1a9f9cddc49d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 18 Jun 2015 13:19:25 +0200 Subject: [PATCH] ServicedowntimestarthistoryQuery: PostgreSQL grouping... refs #9009 --- .../ServicedowntimestarthistoryQuery.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php index 80c08f735..5cadcc01c 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php @@ -109,7 +109,6 @@ class ServicedowntimestarthistoryQuery extends IdoQuery 'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3', array() ); - $this->select->group(array('sdh.downtimehistory_id', 'so.name1', 'so.name2')); } /** @@ -143,7 +142,6 @@ class ServicedowntimestarthistoryQuery extends IdoQuery 'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4', array() ); - $this->select->group(array('sdh.downtimehistory_id', 'so.name1', 'so.name2')); } /** @@ -157,4 +155,21 @@ class ServicedowntimestarthistoryQuery extends IdoQuery array() ); } + + /** + * {@inheritdoc} + */ + public function getGroup() + { + $group = array(); + if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) { + $group = array('sdh.downtimehistory_id', 'so.object_id'); + if ($this->hasJoinedVirtualTable('services')) { + $group[] = 'h.host_id'; + $group[] = 's.service_id'; + } + } + + return $group; + } }