[icinga-checkins] icinga.org: icingaweb2-module-director/master: DirectorObjectForm: skip empty related sets...

git at icinga.org git at icinga.org
Thu Dec 15 11:45:27 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Dec 15 11:44:52 2016 +0100

DirectorObjectForm: skip empty related sets...

...provides as objects

fixes #13605

---

 library/Director/Web/Form/DirectorObjectForm.php |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php
index 4f25158..9a425e6 100644
--- a/library/Director/Web/Form/DirectorObjectForm.php
+++ b/library/Director/Web/Form/DirectorObjectForm.php
@@ -664,6 +664,14 @@ abstract class DirectorObjectForm extends QuickForm
             $key = $element->getName();
             if ($object->hasProperty($key)) {
                 $value = $object->get($key);
+                if ($object instanceof IcingaObject) {
+                    if ($object->propertyIsRelatedSet($key)) {
+                        if (! count((array) $value)) {
+                            continue;
+                        }
+                    }
+                }
+
                 if ($value !== null) {
                     $element->setValue($value);
                 }



More information about the icinga-checkins mailing list