Code

Fixed mail account
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Dec 2007 13:32:03 +0000 (13:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 19 Dec 2007 13:32:03 +0000 (13:32 +0000)
-Vacation start stop saving

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8149 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/mail/class_mailAccount.inc

index ab3c46585d6ff1f9f804b1338f9719adfac6e6b7..bb00ffa84d74bf16e66c403c6147b412612b51bb 100644 (file)
@@ -432,24 +432,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);
         }
       }
 
@@ -810,9 +820,18 @@ class mailAccount extends plugin
           $this->is_modified= TRUE;
         }
         $this->gosaMailDeliveryMode= $tmp;
+
+
+        if($this->acl_is_writeable("gosaVacationMessage") && preg_match("/V/",$this->gosaMailDeliveryMode)){
+          if(isset($_POST['gosaVacationStart'])){
+            $this->gosaVacationStart = $_POST['gosaVacationStart'];
+          }
+          if(isset($_POST['gosaVacationStop'])){
+            $this->gosaVacationStop = $_POST['gosaVacationStop'];
+          }
+        }
       }
     }
-
   }