From efe438c7e9073352e91da8e8c42409f35eeb5e5d Mon Sep 17 00:00:00 2001 From: raviks789 <33730024+raviks789@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:58:03 +0100 Subject: [PATCH] IcingaDependencyForm: Make parent host and parent service element values removeable --- application/forms/IcingaDependencyForm.php | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/application/forms/IcingaDependencyForm.php b/application/forms/IcingaDependencyForm.php index 42887aa7d..bb60fba22 100644 --- a/application/forms/IcingaDependencyForm.php +++ b/application/forms/IcingaDependencyForm.php @@ -344,18 +344,22 @@ public function createApplyRuleFor(IcingaDependency $dependency) protected function handleProperties(DbObject $object, &$values) { if ($this->hasBeenSent()) { - if (isset($values['parent_host']) - && $this->isCustomVar($values['parent_host']) - ) { - $values['parent_host_var'] = \trim($values['parent_host'], '$'); - $values['parent_host'] = ''; + if (isset($values['parent_host'])) { + if ($this->isCustomVar($values['parent_host'])) { + $values['parent_host_var'] = \trim($values['parent_host'], '$'); + $values['parent_host'] = ''; + } else { + $values['parent_host_var'] = ''; + } } - if (isset($values['parent_service']) - && $this->isCustomVar($values['parent_service']) - ) { - $values['parent_service_by_name'] = trim($values['parent_service'], '$'); - $values['parent_service'] = ''; + if (isset($values['parent_service'])) { + if ($this->isCustomVar($values['parent_service'])) { + $values['parent_service_by_name'] = trim($values['parent_service'], '$'); + $values['parent_service'] = ''; + } else { + $values['parent_service_by_name'] = ''; + } } }