From 49dbf5a7f8dfc737a90f01dcd9728a3e28eb8f21 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 21 Apr 2015 11:19:09 +0000 Subject: [PATCH] * Mail/Sieve: require a vacation notice text on vacationnotice edit and save. --- mail/inc/class.mail_sieve.inc.php | 11 ++++++++--- mail/lang/egw_de.lang | 1 + mail/lang/egw_en.lang | 1 + mail/templates/default/sieve.vacation.xet | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mail/inc/class.mail_sieve.inc.php b/mail/inc/class.mail_sieve.inc.php index 444ae02d1e..897b7e3091 100644 --- a/mail/inc/class.mail_sieve.inc.php +++ b/mail/inc/class.mail_sieve.inc.php @@ -538,7 +538,7 @@ class mail_sieve { $ByDate = array('by_date' => lang('By date')); } - if (!is_array($content) || ($content['acc_id'] && !isset($content['button']))) + if (!is_array($content) || ($content['acc_id'] && !isset($content['button'])) || (strlen(trim($content['text']))==0 && in_array($content['status'],array('on','by_date')))) { $content = $vacation = $vacRules['vacation']; if (!empty($profileID)) $content['acc_id'] = $profileID; @@ -554,7 +554,12 @@ class mail_sieve { $content['forwards'] = ''; } - if (empty($vacation['text']) && $this->mailConfig['default_vacation_text']) $content['text'] = $this->mailConfig['default_vacation_text']; + if (strlen(trim($vacation['text']))==0 && $this->mailConfig['default_vacation_text']) $content['text'] = $this->mailConfig['default_vacation_text']; + if (strlen(trim($content['text']))==0) + { + $content['msg'] = $msg = lang('error').': '.lang('No vacation notice text provided. Please enter a message.'); + egw_framework::refresh_opener($msg, 'mail'); + } //Set default value for days new entry if (empty($content['days'])) { @@ -575,7 +580,7 @@ class mail_sieve if ($GLOBALS['egw_info']['user']['apps']['admin']) { // store text as default - if ($content['set_as_default'] == 1) + if ($content['set_as_default'] == 1 && $content['text']) { config::save_value('default_vacation_text', $content['text'], 'mail'); } diff --git a/mail/lang/egw_de.lang b/mail/lang/egw_de.lang index 7742f8297d..ca9e33c526 100644 --- a/mail/lang/egw_de.lang +++ b/mail/lang/egw_de.lang @@ -282,6 +282,7 @@ no signature mail de keine Signatur no subject given! mail de Kein Betreff angegeben! no subject supplied mail de Kein Betreff angegeben! no text body supplied, check attachments for message text mail de Keine Text vorhanden, bitte sehen Sie sich die Anlagen dieser E-Mail an. +no vacation notice text provided. Please enter a message. mail de Kein Nachrichtentext vorhanden. Sie müssen einen Nachrichtentext eingeben um Ihre Abwesendheitsnotiz speichern (ändern, aktivieren oder deaktivieren) zu können. no valid %1 folder configured! mail de Kein gültiger %1 Ordner eingestellt! non mail de Kein none, create all mail de keine, erstellt alle diff --git a/mail/lang/egw_en.lang b/mail/lang/egw_en.lang index 06ee039463..298e697fd5 100644 --- a/mail/lang/egw_en.lang +++ b/mail/lang/egw_en.lang @@ -282,6 +282,7 @@ no signature mail en no signature no subject given! mail en No subject given! no subject supplied mail en no subject supplied no text body supplied, check attachments for message text mail en no text body supplied, check attachments for message text +no vacation notice text provided. Please enter a message. mail en No vacation notice text provided. Please enter a message. no valid %1 folder configured! mail en No valid %1 folder configured! non mail en Non none, create all mail en none, create all diff --git a/mail/templates/default/sieve.vacation.xet b/mail/templates/default/sieve.vacation.xet index e0d24f7932..5fc84f3957 100644 --- a/mail/templates/default/sieve.vacation.xet +++ b/mail/templates/default/sieve.vacation.xet @@ -46,7 +46,7 @@ - +