diff --git a/ingo/docs/CHANGES b/ingo/docs/CHANGES index b4d22b4fd57..c38a1753144 100644 --- a/ingo/docs/CHANGES +++ b/ingo/docs/CHANGES @@ -2,8 +2,7 @@ v4.0.0-git ---------- -[jan] Allow to set vaction with only start or end date, if Sieve date extension - is available. +[jan] Allow to set vaction with only start or end date, if supported. [jan] Add support for Sieve date extension to vacation messages (Request #12520). [mjr] Export active vacation messages via the timeObjects API (Request #10885). diff --git a/ingo/lib/Script/Maildrop/Recipe.php b/ingo/lib/Script/Maildrop/Recipe.php index dd4f8b7a699..9954dec2be9 100644 --- a/ingo/lib/Script/Maildrop/Recipe.php +++ b/ingo/lib/Script/Maildrop/Recipe.php @@ -154,12 +154,17 @@ public function __construct($params = array(), $scriptparams = array()) } // Rule : Start/End of vacation - if (($start != 0) && ($end !== 0)) { + if ($start != 0 || $end != 0) { $this->_action[] = ' flock "$HOME/vacationprocess.lock" {'; $this->_action[] = ' current_time=time'; $this->_action[] = ' if ( \ '; - $this->_action[] = ' ($current_time >= ' . $start . ') && \ '; - $this->_action[] = ' ($current_time <= ' . $end . ')) '; + if ($start != 0) { + $this->_action[] = ' ($current_time >= ' . $start + . ($end != 0 ? ') && \ ' : ') '); + } + if ($end != 0) { + $this->_action[] = ' ($current_time <= ' . $end . ')) '; + } $this->_action[] = ' {'; } $this->_action[] = ' cc "' . str_replace('"', '\\"', sprintf( diff --git a/ingo/lib/Script/Procmail/Recipe.php b/ingo/lib/Script/Procmail/Recipe.php index dfdd82fe620..97638e6897e 100644 --- a/ingo/lib/Script/Procmail/Recipe.php +++ b/ingo/lib/Script/Procmail/Recipe.php @@ -148,8 +148,6 @@ public function __construct($params = array(), $scriptparams = array()) case 'Ingo_Rule_System_Vacation': $days = $params['action-value']['days']; - $timed = !empty($params['action-value']['start']) && - !empty($params['action-value']['end']); $this->_action[] = '{'; foreach ($params['action-value']['addresses'] as $address) { if (empty($address)) { @@ -174,9 +172,11 @@ public function __construct($params = array(), $scriptparams = array()) . 'test $FILEDATE -le $DATE && ' . 'rm ${VACATION_DIR:-.}/\'.vacation.' . $address . '\'`'; } - if ($timed) { + if (!empty($params['action-value']['start'])) { $this->_action[] = ' START=' . $params['action-value']['start']; + } + if (!empty($params['action-value']['end'])) { $this->_action[] = ' END=' . $params['action-value']['end']; } @@ -186,9 +186,20 @@ public function __construct($params = array(), $scriptparams = array()) $this->_action[] = ''; $this->_action[] = ' :0 Wc: ${VACATION_DIR:-.}/vacation.lock'; - if ($timed) { - $this->_action[] = - ' * ? test $DATE -gt $START && test $END -gt $DATE'; + if (!empty($params['action-value']['start']) || + !empty($params['action-value']['end'])) { + $test = ' * ?'; + if (!empty($params['action-value']['start'])) { + $test .= ' test $DATE -gt $START'; + } + if (!empty($params['action-value']['start']) && + !empty($params['action-value']['end'])) { + $test .= ' &&'; + } + if (!empty($params['action-value']['end'])) { + $test .= ' test $END -gt $DATE'; + } + $this->_action[] = $test; } $this->_action[] = ' {'; $this->_action[] = ' :0 Wh'; diff --git a/ingo/package.xml b/ingo/package.xml index d99e730a5cf..ff3f9377c2f 100644 --- a/ingo/package.xml +++ b/ingo/package.xml @@ -33,7 +33,7 @@ ASL -* [jan] Allow to set vaction with only start or end date, if Sieve date extension is available. +* [jan] Allow to set vaction with only start or end date, if supported. * [jan] Add support for Sieve date extension to vacation messages (Request #12520). * [mjr] Export active vacation messages via the timeObjects API (Request #10885). * [mms] Added a NoSQL (MongoDB) driver for the storage backend. @@ -1779,7 +1779,7 @@ ASL -* [jan] Allow to set vaction with only start or end date, if Sieve date extension is available. +* [jan] Allow to set vaction with only start or end date, if supported. * [jan] Add support for Sieve date extension to vacation messages (Request #12520). * [mjr] Export active vacation messages via the timeObjects API (Request #10885). * [mms] Added a NoSQL (MongoDB) driver for the storage backend.