[icinga-checkins] icinga.org: icingaweb2-module-director/feature/icinga-legacy-config-13049: IcingaCommandForm: allow to import any command

git at icinga.org git at icinga.org
Wed Nov 16 09:25:20 CET 2016


Module: icingaweb2-module-director
Branch: feature/icinga-legacy-config-13049
Commit: 2725ef54e65db01d7775ea665823d6950fecf40d
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=2725ef54e65db01d7775ea665823d6950fecf40d

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Nov 15 18:23:39 2016 +0100

IcingaCommandForm: allow to import any command

fixes #12978

---

 application/forms/IcingaCommandForm.php |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/application/forms/IcingaCommandForm.php b/application/forms/IcingaCommandForm.php
index 0e097c1..b4db1c6 100644
--- a/application/forms/IcingaCommandForm.php
+++ b/application/forms/IcingaCommandForm.php
@@ -73,4 +73,26 @@ class IcingaCommandForm extends DirectorObjectForm
 
         $this->setButtons();
     }
+
+    protected function enumAllowedTemplates()
+    {
+        $object = $this->object();
+        $tpl = $this->db->enum($object->getTableName());
+        if (empty($tpl)) {
+            return array();
+        }
+
+        $id = $object->get('id');
+
+        if (array_key_exists($id, $tpl)) {
+            unset($tpl[$id]);
+        }
+
+        if (empty($tpl)) {
+            return array();
+        }
+
+        $tpl = array_combine($tpl, $tpl);
+        return $tpl;
+    }
 }



More information about the icinga-checkins mailing list