From c2afacc11bae95cfd2ebbd070615dbaeac3e4720 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 27 Aug 2017 18:59:32 +0200 Subject: [PATCH] IcingaServiceSet: createWhere() look for template ...in case no host_id has been set --- library/Director/Objects/IcingaServiceSet.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Director/Objects/IcingaServiceSet.php b/library/Director/Objects/IcingaServiceSet.php index 04ccb34b..dd23c753 100644 --- a/library/Director/Objects/IcingaServiceSet.php +++ b/library/Director/Objects/IcingaServiceSet.php @@ -249,6 +249,18 @@ class IcingaServiceSet extends IcingaObject } } + public function createWhere() + { + $where = parent::createWhere(); + if (! $this->hasBeenLoadedFromDb()) { + if (null === $this->get('host_id') && null === $this->get('id')) { + $where .= " AND object_type = 'template'"; + } + } + + return $where; + } + protected function beforeStore() { parent::beforeStore();