Code

Simplified attribute mapping
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 15 Sep 2010 09:00:23 +0000 (09:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 15 Sep 2010 09:00:23 +0000 (09:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19676 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_groupware.inc

index 7a4fa3965b8dd3fb6fbbadf37d3c5cc2a6b4fbf9..2739d02e6227a3e597816fa69adc083fe5f1d8c5 100644 (file)
@@ -815,29 +815,35 @@ class groupware extends plugin
      */
     function mapComprehensiveUserData($callBackMap)
     {
-        //dropdown
-        $this->mailLocations = $callBackMap["mailLocations"];
-        //data from the groupware
-        $this->mailAddress = $callBackMap["primaryMail"];
-        $this->mailLocation = $callBackMap["mailLocation"];
-        $this->quotaUsage = $callBackMap["quotaUsage"];
-        $this->quotaSize = $callBackMap["quotaSize"];
-        $this->alternateAddresses = $callBackMap["alternateAddresses"];
-        $this->forwardingAddresses = $callBackMap["forwardingAddresses"];
-        $this->vacationEnabled = $callBackMap["vacationEnabled"];
-        $this->vacationStart = $callBackMap["vacationStart"];
-        $this->vacationStop = $callBackMap["vacationStop"];
-        $this->vacationMessage = $callBackMap["vacationMessage"];
-        $this->mailBoxWarnLimitEnabled = $callBackMap["mailBoxWarnLimitEnabled"];
-        $this->mailBoxWarnLimitValue = $callBackMap["mailBoxWarnLimitValue"];
-        $this->mailBoxSendSizelimitEnabled = $callBackMap["mailBoxSendSizelimitEnabled"];
-        $this->mailBoxSendSizelimitValue = $callBackMap["mailBoxSendSizelimitValue"];
-        $this->mailBoxHardSizelimitEnabled = $callBackMap["mailBoxHardSizelimitEnabled"];
-        $this->mailBoxHardSizelimitValue = $callBackMap["mailBoxHardSizelimitValue"];
-        $this->mailBoxAutomaticRemovalEnabled = $callBackMap["mailBoxAutomaticRemovalEnabled"];
-        $this->mailBoxAutomaticRemovalValue = $callBackMap["mailBoxAutomaticRemovalValue"];
-        $this->localDeliveryOnly = $callBackMap["localDeliveryOnly"];
-        $this->dropOwnMails = $callBackMap["dropOwnMails"];
+        $map = array(
+                "mailLocations" => "mailLocations",
+                "mailAddress" => "primaryMail",
+                "mailLocation" => "mailLocation",
+                "quotaUsage" => "quotaUsage",
+                "quotaSize" => "quotaSize",
+                "alternateAddresses" => "alternateAddresses",
+                "forwardingAddresses" => "forwardingAddresses",
+                "vacationEnabled" => "vacationEnabled",
+                "vacationStart" => "vacationStart",
+                "vacationStop" => "vacationStop",
+                "vacationMessage" => "vacationMessage",
+                "mailBoxWarnLimitEnabled" => "mailBoxWarnLimitEnabled",
+                "mailBoxWarnLimitValue" => "mailBoxWarnLimitValue",
+                "mailBoxSendSizelimitEnabled" => "mailBoxSendSizelimitEnabled",
+                "mailBoxSendSizelimitValue" => "mailBoxSendSizelimitValue",
+                "mailBoxHardSizelimitEnabled" => "mailBoxHardSizelimitEnabled",
+                "mailBoxHardSizelimitValue" => "mailBoxHardSizelimitValue",
+                "mailBoxAutomaticRemovalEnabled" => "mailBoxAutomaticRemovalEnabled",
+                "mailBoxAutomaticRemovalValue" => "mailBoxAutomaticRemovalValue",
+                "localDeliveryOnly" => "localDeliveryOnly",
+                "dropOwnMails" => "dropOwnMails");
+
+        // Map values from source array to class members
+        foreach($map as $target => $source){
+            if(isset($callBackMap[$source])){
+                $this->$target = $callBackMap[$source];
+            }
+        }
     }
 }