diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostcommenthistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostcommenthistoryQuery.php index c3ac3b860..1a311b05f 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostcommenthistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostcommenthistoryQuery.php @@ -13,6 +13,16 @@ class HostcommenthistoryQuery extends IdoQuery */ protected $allowCustomVars = true; + /** + * {@inheritdoc} + */ + protected $groupBase = array('commenthistory' => array('hch.commenthistory_id', 'ho.object_id')); + + /** + * {@inheritdoc} + */ + protected $groupOrigin = array('hostgroups', 'services'); + /** * {@inheritdoc} */ @@ -23,14 +33,12 @@ class HostcommenthistoryQuery extends IdoQuery 'commenthistory' => array( 'host' => 'ho.name1 COLLATE latin1_general_ci', 'host_name' => 'ho.name1', - 'object_type' => '(\'host\')' - ), - 'history' => array( - 'type' => "(CASE hch.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)", - 'timestamp' => 'UNIX_TIMESTAMP(hch.comment_time)', - 'object_id' => 'hch.object_id', - 'state' => '(-1)', - 'output' => "('[' || hch.author_name || '] ' || hch.comment_data)", + 'object_type' => '(\'host\')', + 'type' => "(CASE hch.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)", + 'timestamp' => 'UNIX_TIMESTAMP(hch.comment_time)', + 'object_id' => 'hch.object_id', + 'state' => '(-1)', + 'output' => "('[' || hch.author_name || '] ' || hch.comment_data)", ), 'hostgroups' => array( 'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci', @@ -80,7 +88,6 @@ class HostcommenthistoryQuery extends IdoQuery array() ); $this->joinedVirtualTables['commenthistory'] = true; - $this->joinedVirtualTables['history'] = true; } /** @@ -163,20 +170,4 @@ class HostcommenthistoryQuery extends IdoQuery array() ); } - - /** - * {@inheritdoc} - */ - public function getGroup() - { - $group = array(); - if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('services')) { - $group = array('hch.commenthistory_id', 'ho.object_id'); - if ($this->hasJoinedVirtualTable('hosts')) { - $group[] = 'h.host_id'; - } - } - - return $group; - } }