From 26e6acf9af023ef14596bc9a5dbd61cea44d958b Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 13 Nov 2015 14:42:21 +0100 Subject: [PATCH] ListController: Fix servicegrid grouping when applying group restrictions #2 PostgreSQL had still issues with it. Quickfix only, again. refs #10316 --- library/Icinga/Data/PivotTable.php | 2 ++ .../monitoring/application/controllers/ListController.php | 1 - .../library/Monitoring/Backend/Ido/Query/IdoQuery.php | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Data/PivotTable.php b/library/Icinga/Data/PivotTable.php index 906703174..8423c2dfa 100644 --- a/library/Icinga/Data/PivotTable.php +++ b/library/Icinga/Data/PivotTable.php @@ -226,6 +226,7 @@ class PivotTable implements Sortable { if ($this->xAxisQuery === null) { $this->xAxisQuery = clone $this->baseQuery; + $this->xAxisQuery->clearGroupingRules(); $xAxisHeader = $this->getXAxisHeader(); $columns = array($this->xAxisColumn, $xAxisHeader); $this->xAxisQuery->group(array_unique($columns)); // xAxisColumn and header may be the same column @@ -253,6 +254,7 @@ class PivotTable implements Sortable { if ($this->yAxisQuery === null) { $this->yAxisQuery = clone $this->baseQuery; + $this->yAxisQuery->clearGroupingRules(); $yAxisHeader = $this->getYAxisHeader(); $columns = array($this->yAxisColumn, $yAxisHeader); $this->yAxisQuery->group(array_unique($columns)); // yAxisColumn and header may be the same column diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 2e3ab27aa..c0ae1133f 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -545,7 +545,6 @@ class ListController extends Controller $this->applyRestriction('monitoring/filter/objects', $query); $this->filterQuery($query); $filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null; - $query->getQuery()->setGroupBase(array()); $pivot = $query ->pivot( 'service_description', diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index d7d279c3a..5edc8f6f1 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -991,9 +991,10 @@ abstract class IdoQuery extends DbQuery return $this; } - public function setGroupBase(array $groupBase) + public function clearGroupingRules() { - $this->groupBase = $groupBase; + $this->groupBase = array(); + $this->groupOrigin = array(); return $this; }