Fix "Later" vs "Next 7 days" filter inconsistence (#5353)

This commit is contained in:
Aleksander Machniak 2016-06-15 06:30:32 -04:00 committed by Aleksander Machniak
parent 7fccfb7f7e
commit 5538501909

View file

@ -1325,19 +1325,27 @@ class tasklist extends rcube_plugin
*/ */
public function filter_mask($rec) public function filter_mask($rec)
{ {
static $today, $today_date, $tomorrow, $tomorrow_date, $week_date, $weeklimit; static $today, $today_date, $tomorrow, $weeklimit;
if (!$today) { if (!$today) {
$today_date = new DateTime('now', $this->timezone); $today_date = new DateTime('now', $this->timezone);
$today = $today_date->format('Y-m-d'); $today = $today_date->format('Y-m-d');
$tomorrow_date = new DateTime('now + 1 day', $this->timezone); $tomorrow_date = new DateTime('now + 1 day', $this->timezone);
$tomorrow = $tomorrow_date->format('Y-m-d'); $tomorrow = $tomorrow_date->format('Y-m-d');
$week_date = new DateTime('now + 7 days', $this->timezone);
$weeklimit = $week_date->format('Y-m-d'); // In Kolab-mode we hide "Next 7 days" filter, which means
// "Later" should catch tasks with date after tomorrow (#5353)
if ($this->rc->output->get_env('tasklist_driver') == 'kolab') {
$weeklimit = $tomorrow;
}
else {
$week_date = new DateTime('now + 7 days', $this->timezone);
$weeklimit = $week_date->format('Y-m-d');
}
} }
$mask = 0; $mask = 0;
$start = $rec['startdate'] ?: '1900-00-00'; $start = $rec['startdate'] ?: '1900-00-00';
$duedate = $rec['date'] ?: '3000-00-00'; $duedate = $rec['date'] ?: '3000-00-00';
if ($rec['flagged']) if ($rec['flagged'])