Code

(groupware) repaired forwarding addresses.
authorhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Nov 2010 14:55:05 +0000 (14:55 +0000)
committerhzerres <hzerres@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 22 Nov 2010 14:55:05 +0000 (14:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20323 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_Groupware.inc
gosa-plugins/groupware/personal/groupware/class_GroupwareDao.inc

index f3078002ae8f0c818a1b63ec3d32a22c4d486a96..ebb823412c9f0b98c1bc5fe34af6ab8b2d4a1923 100644 (file)
@@ -835,10 +835,14 @@ class Groupware extends plugin
 
         // Save alternateAddresses 
         if($this->isFeatureEnabled("alternateAddresses")&& $this->hasFeaturebeenChanged("alternateAddresses")){
-            if(!empty($this->alternateAddresses) 
-                    && isset($this->alternateAddresses) 
-                    && is_array($this->alternateAddresses)){
-                $res = $this->groupwareDao->save("alternateAddresses", $this->uid, array($this->alternateAddresses));
+            if(isset($this->alternateAddresses) && is_array($this->alternateAddresses)){
+                               if(!empty($this->alternateAddresses)){
+                                       $res = $this->groupwareDao->save("alternateAddresses", $this->uid, array($this->alternateAddresses));
+                               }
+                               else{
+                               echo "deleting AltAddresses.";
+                                       $res = $this->groupwareDao->save("alternateAddresses", $this->uid, array(array()));
+                               }
                 if($res === NULL){
                     $message = _("Saving alternate addresses failed!");
                     msg_dialog::display(_("Error"),$message."<br>".sprintf(_("Error was: '%s'."),$this->rpcErrorMessage),ERROR_DIALOG);
@@ -851,9 +855,15 @@ class Groupware extends plugin
 
             // Transform simple address array into,  $addresses[address] = ForwardFlag;
             $addresses = array();
-            foreach($this->forwardingAddresses as $address) $addresses[$address] = TRUE;
-
-            $res = $this->groupwareDao->save("forwardingAddresses", $this->uid, array($addresses));
+                       if(!empty($this->forwardingAddresses)){
+                               foreach($this->forwardingAddresses as $address) $addresses[$address] = TRUE;
+                       
+                               $res = $this->groupwareDao->save("forwardingAddresses", $this->uid, array($addresses));
+                       }
+                       else{   
+                               $res = $this->groupwareDao->save("forwardingAddresses", $this->uid, array(array()));
+                       }
+            
             if($res === NULL){
                 $message = _("Saving forward addresses failed!");
                 msg_dialog::display(_("Error"),$message."<br>".sprintf(_("Error was: '%s'."),$this->rpcErrorMessage),ERROR_DIALOG);
index 3bebc00a62916ddbca8764bfda63940c99cb94a9..96588532455ac5cec8be1bb01cec1068f580b921 100644 (file)
@@ -108,11 +108,15 @@ class GroupwareDao{
                                $valueArray = array($function, $uid, $valueArray);
                        }
                        else{
+
                                //omit otherwise
                                $valueArray = array($function, $uid);
                        }
         }
-               
+               //TODO: Remove the debug output
+               //echo "----call_user_func_array:<pre>";
+               //var_dump($valueArray);
+               //echo "</pre>";
         $result =  call_user_func_array(array($this->groupwarePluginRef, 'rpcExec'), $valueArray);
         return $result;
     }