From 4501935040d18199cd61c1c720ebfb3ed2edccc8 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 2 Jan 2017 11:09:15 +0100 Subject: [PATCH] ServiceController: fix issue with hidden feature Services imported with use_var_overrides used to throw an error since we introduced the new template resolver --- application/controllers/ServiceController.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/controllers/ServiceController.php b/application/controllers/ServiceController.php index 14217ae2..d61c2326 100644 --- a/application/controllers/ServiceController.php +++ b/application/controllers/ServiceController.php @@ -118,7 +118,8 @@ class ServiceController extends ObjectController $parent = IcingaService::create(array( 'object_type' => 'template', - 'object_name' => 'myself', + // TODO: => 'myself', -> There is no such import: "myself" + 'object_name' => $object->object_name, 'vars' => $object->vars, ), $this->db()); @@ -126,8 +127,16 @@ class ServiceController extends ObjectController $object->imports()->add($parent); } - parent::editAction(); + $this->getTabs()->activate('modify'); + $this->view->form = $form = $this->loadForm('icingaService') + ->setDb($this->db()) + ->setObject($object); + + $this->view->form->handleRequest(); + $this->view->actionLinks = $this->createCloneLink(); + + $this->view->title = $object->object_name; if ($this->host) { $this->view->subtitle = sprintf( $this->translate('(on %s)'), @@ -150,6 +159,8 @@ class ServiceController extends ObjectController } catch (Exception $e) { // ignore the error, show no apply link } + + $this->setViewScript('object/form'); } public function assignAction()