[icinga-checkins] icinga.org: icingaweb2-module-director/master: SyncPropertyForm: Only try to enum imports when we are able to

git at icinga.org git at icinga.org
Fri Nov 11 11:07:09 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 699b6a7293ea47357fab19e3ee78196a2c1b2ace
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=699b6a7293ea47357fab19e3ee78196a2c1b2ace

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Wed Nov  9 10:44:02 2016 +0100

SyncPropertyForm: Only try to enum imports when we are able to

This allows a user to use fields or custom expression for serviceSet.

refs #12891

---

 application/forms/SyncPropertyForm.php |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/application/forms/SyncPropertyForm.php b/application/forms/SyncPropertyForm.php
index 771083b..b8d3835 100644
--- a/application/forms/SyncPropertyForm.php
+++ b/application/forms/SyncPropertyForm.php
@@ -160,14 +160,16 @@ class SyncPropertyForm extends DirectorObjectForm
 
         if ($destination === 'import') {
             $funcTemplates = 'enum' . ucfirst($this->rule->get('object_type')) . 'Templates';
-            $templates = $this->db->$funcTemplates();
-            if (! empty($templates)) {
-                $templates = array_combine($templates, $templates);
-            }
+            if (method_exists($this->db, $funcTemplates)) {
+                $templates = $this->db->$funcTemplates();
+                if (! empty($templates)) {
+                    $templates = array_combine($templates, $templates);
+                }
 
-            $importTitle = $this->translate('Existing templates');
-            $columns[$importTitle] = $templates;
-            natsort($columns[$importTitle]);
+                $importTitle = $this->translate('Existing templates');
+                $columns[$importTitle] = $templates;
+                natsort($columns[$importTitle]);
+            }
         }
 
         $xpTitle = $this->translate('Expert mode');



More information about the icinga-checkins mailing list