Code

Fixed Vacation message start/stop saving.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Dec 2007 12:53:39 +0000 (12:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Dec 2007 12:53:39 +0000 (12:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8147 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/mail/class_mailAccount.inc

index a3b12bf511b2aa21fde3f04ba666aa0f124da4bf..d1415d32b23cc010b73a9d9c625e0fa97b66d1b8 100644 (file)
@@ -438,24 +438,34 @@ class mailAccount extends plugin
       }
 
       /* Replace attributes */
-      $attrs= $this->parent->by_object['user']->attributes;
-      foreach ($attrs as $val){
-        
-        if(preg_match("/dateOfBirth/",$val)){
-          if($this->parent->by_object['user']->use_dob){
-            $contents= preg_replace("/%$val/",date("Y-d-m",$this->parent->by_object['user']->dateOfBirth),$contents);
+      $attrs = array();
+      $obj = NULL;
+      if(isset($this->parent->by_object['user'])){
+        $attrs  = $this->parent->by_object['user']->attributes;
+        $obj    = $this->parent->by_object['user'];
+      }else{
+        $obj    = new user($this->config,$this->dn);
+        $attrs  = $obj->attributes;
+      }
+
+      if($obj){
+        foreach ($attrs as $val){
+          if(preg_match("/dateOfBirth/",$val)){
+            if($obj->use_dob){
+              $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
+            }
+          }else {
+            $contents= preg_replace("/%$val/",
+                $obj->$val, $contents);
+          }
+
+          /* Replace vacation start and end time */
+          if(preg_match("/%start/",$contents)){
+            $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
+          }
+          if(preg_match("/%end/",$contents)){
+            $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
           }
-        }else {
-          $contents= preg_replace("/%$val/",
-              $this->parent->by_object['user']->$val, $contents);
-        }
-        
-        /* Replace vacation start and end time */
-        if(preg_match("/%start/",$contents)){
-          $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
-        }
-        if(preg_match("/%end/",$contents)){
-          $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
         }
       }
 
@@ -849,8 +859,12 @@ class mailAccount extends plugin
         $this->is_modified= TRUE;
       }
       $this->gosaMailDeliveryMode= $tmp;
-    }
 
+      if(chkacl($this->acl,"gosaVacationMessage") == "" && preg_match("/V/",$this->gosaMailDeliveryMode)){
+        $this->gosaVacationStart = $_POST['gosaVacationStart']; 
+        $this->gosaVacationStop = $_POST['gosaVacationStop']; 
+      }
+    }
   }