From 8185f8b8a9dc9b6602a868bb11bc6d9ec8b070d2 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 17 Jun 2014 14:02:54 +0000 Subject: [PATCH] Ido\EventHistoryQuery: fix it to fit new filters Works for single objects, still some work required for "generic" history. --- .../Backend/Ido/Query/EventHistoryQuery.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php index 477c521fd..6c8deea90 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/EventHistoryQuery.php @@ -55,14 +55,14 @@ class EventHistoryQuery extends IdoQuery $this->createSubQuery('Downtimestarthistory', $columns), $this->createSubQuery('Downtimeendhistory', $columns), $this->createSubQuery('Commenthistory', $columns), + $this->createSubQuery('Commentdeletionhistory', $columns), $this->createSubQuery('Notificationhistory', $columns) ); - $sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL); $this->select->from( array('eho' => $this->prefix . 'objects'), - array() + '*' )->join( array('eh' => $sub), 'eho.' . $this->object_id . ' = eh.' . $this->object_id . ' AND eho.is_active = 1', @@ -71,6 +71,24 @@ class EventHistoryQuery extends IdoQuery $this->joinedVirtualTables = array('eventhistory' => true); } + public function order($columnOrAlias, $dir = null) + { + foreach ($this->subQueries as $sub) { + $sub->requireColumn($columnOrAlias); + } + + return parent::order($columnOrAlias, $dir); + } + + public function where($condition, $value = null) + { + $this->requireColumn($condition); + foreach ($this->subQueries as $sub) { + $sub->where($condition, $value); + } + return $this; + } + protected function joinHostgroups() { $this->select->join(