diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php index 4ab58f6cd..a54fca4c8 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicedowntimestarthistoryQuery.php @@ -13,6 +13,16 @@ class ServicedowntimestarthistoryQuery extends IdoQuery */ protected $allowCustomVars = true; + /** + * {@inheritdoc} + */ + protected $groupBase = array('downtimehistory', array('sdh.downtimehistory_id', 'so.object_id')); + + /** + * {@inheritdoc} + */ + protected $groupOrigin = array('hostgroups', 'servicegroups'); + /** * {@inheritdoc} */ @@ -23,18 +33,16 @@ class ServicedowntimestarthistoryQuery extends IdoQuery 'downtimehistory' => array( 'host' => 'so.name1 COLLATE latin1_general_ci', 'host_name' => 'so.name1', + 'object_id' => 'sdh.object_id', 'object_type' => '(\'service\')', + 'output' => "('[' || sdh.author_name || '] ' || sdh.comment_data)", 'service' => 'so.name2 COLLATE latin1_general_ci', 'service_description' => 'so.name2', 'service_host' => 'so.name1 COLLATE latin1_general_ci', - 'service_host_name' => 'so.name1' - ), - 'history' => array( - 'type' => "('dt_start')", - 'timestamp' => 'UNIX_TIMESTAMP(sdh.actual_start_time)', - 'object_id' => 'sdh.object_id', - 'state' => '(-1)', - 'output' => "('[' || sdh.author_name || '] ' || sdh.comment_data)", + 'service_host_name' => 'so.name1', + 'state' => '(-1)', + 'timestamp' => 'UNIX_TIMESTAMP(sdh.actual_start_time)', + 'type' => "('dt_start')" ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', @@ -90,7 +98,6 @@ class ServicedowntimestarthistoryQuery extends IdoQuery } $this->joinedVirtualTables['downtimehistory'] = true; - $this->joinedVirtualTables['history'] = true; } /** @@ -170,21 +177,4 @@ 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; - } }