From bd5ad64f02bffb147794cbe2f1bda9e006375f25 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 5 Jun 2018 11:05:43 +0200 Subject: [PATCH] IcingaServiceForm: fix "blacklist" for overrides ...when defined being such via Sync rule --- application/forms/IcingaServiceForm.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/application/forms/IcingaServiceForm.php b/application/forms/IcingaServiceForm.php index ffb824c2..56e1b904 100644 --- a/application/forms/IcingaServiceForm.php +++ b/application/forms/IcingaServiceForm.php @@ -51,6 +51,10 @@ class IcingaServiceForm extends DirectorObjectForm */ public function setup() { + if (!$this->isNew() || $this->providesOverrides()) { + $this->tryToFetchHost(); + } + if ($this->providesOverrides()) { return; } @@ -60,14 +64,6 @@ class IcingaServiceForm extends DirectorObjectForm return; } - try { - if (!$this->isNew() && $this->host === null) { - $this->host = $this->object->getResolvedRelated('host'); - } - } catch (NestingError $nestingError) { - // ignore for the form to load - } - if ($this->set !== null) { $this->setupSetRelatedElements(); } elseif ($this->host === null) { @@ -77,6 +73,17 @@ class IcingaServiceForm extends DirectorObjectForm } } + protected function tryToFetchHost() + { + try { + if ($this->host === null) { + $this->host = $this->object->getResolvedRelated('host'); + } + } catch (NestingError $nestingError) { + // ignore for the form to load + } + } + protected function providesOverrides() { return $this->applyGenerated