From 89441b753ea3c48163e89ac8b1a957d3360878c9 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 19 Dec 2007 12:53:39 +0000 Subject: [PATCH] Fixed Vacation message start/stop saving. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8147 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/mail/class_mailAccount.inc | 50 +++++++++++++-------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index a3b12bf51..d1415d32b 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -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']; + } + } } -- 2.30.2