[icinga-checkins] icinga.org: icingaweb2/bugfix/ group_name_attribute-should-be-sAMAccountName-by-default-12295: Form: Unset defaults if element has attribute "disabled" in preserveDefaults

git at icinga.org git at icinga.org
Wed Jan 11 11:04:15 CET 2017


Module: icingaweb2
Branch: bugfix/group_name_attribute-should-be-sAMAccountName-by-default-12295
Commit: 594f2485e3c814494ed4393cf750ea414c409eac
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=594f2485e3c814494ed4393cf750ea414c409eac

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Mon Jan  9 17:06:26 2017 +0100

Form: Unset defaults if element has attribute "disabled" in preserveDefaults

refs #12295

---

 library/Icinga/Web/Form.php |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php
index cf56149..4246459 100644
--- a/library/Icinga/Web/Form.php
+++ b/library/Icinga/Web/Form.php
@@ -1107,11 +1107,12 @@ class Form extends Zend_Form
      */
     protected function preserveDefaults(Zend_Form $form, array & $defaults)
     {
-        foreach ($form->getElements() as $name => $_) {
+        foreach ($form->getElements() as $name => $element) {
             if (
-                array_key_exists($name, $defaults)
+                (array_key_exists($name, $defaults)
                 && array_key_exists($name . static::DEFAULT_SUFFIX, $defaults)
-                && $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX]
+                && $defaults[$name] === $defaults[$name . static::DEFAULT_SUFFIX])
+                || $element->getAttrib('disabled')
             ) {
                 unset($defaults[$name]);
             }



More information about the icinga-checkins mailing list