From a423694a99271a91f6ac5d50811d1a417e8d27cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Thu, 12 Jul 2018 12:54:59 +0200
Subject: [PATCH] :ambulance: fix(simpleplugin) Do not reset SetAttribute to
 default in loadAttrValue

This was resulting in failing to fill SetAttribute in templates.
But it was also inconsistent with mono-values attributes.

issue #5857
---
 include/simpleplugin/attributes/class_SetAttribute.inc | 6 ------
 include/simpleplugin/class_Attribute.inc               | 4 ----
 2 files changed, 10 deletions(-)

diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc
index f27f3c5df..515e58896 100644
--- a/include/simpleplugin/attributes/class_SetAttribute.inc
+++ b/include/simpleplugin/attributes/class_SetAttribute.inc
@@ -64,8 +64,6 @@ class SetAttribute extends Attribute
       for ($i = 0; $i < $attrs[$this->getLdapName()]["count"]; $i++) {
         $this->value[] = $attrs[$this->getLdapName()][$i];
       }
-    } else {
-      $this->resetToDefault();
     }
   }
 
@@ -429,8 +427,6 @@ class OrderedArrayAttribute extends SetAttribute
           $this->value[] = $value;
         }
       }
-    } else {
-      $this->resetToDefault();
     }
     if ($this->order) {
       $this->reIndexValues();
@@ -706,8 +702,6 @@ class SubNodesAttribute extends OrderedArrayAttribute
         unset($attribute);
         $this->value[] = $this->attribute->getValue();
       }
-    } else {
-      $this->resetToDefault();
     }
   }
 
diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc
index 83f063dac..fb76a203d 100644
--- a/include/simpleplugin/class_Attribute.inc
+++ b/include/simpleplugin/class_Attribute.inc
@@ -777,8 +777,6 @@ class HiddenArrayAttribute extends HiddenAttribute
       for ($i = 0; $i < $attrs[$this->getLdapName()]['count']; $i++) {
         $this->value[] = $attrs[$this->getLdapName()][$i];
       }
-    } else {
-      $this->resetToDefault();
     }
   }
 }
@@ -859,8 +857,6 @@ class DisplayLDAPArrayAttribute extends Attribute
       for ($i = 0; $i < $attrs[$this->getLdapName()]['count']; $i++) {
         $this->value[] = $attrs[$this->getLdapName()][$i];
       }
-    } else {
-      $this->resetToDefault();
     }
   }
 
-- 
GitLab