From 16f617b63793591979d1460c6a8b3bb8983e0cc8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20M=C3=A1t=C3=A9?= Date: Fri, 20 Sep 2013 23:09:43 +1200 Subject: [PATCH] fix of major todo synchronization issue if $c->hide_older_than option is set todo without start date was never synced --- inc/caldav-PROPFIND.php | 2 +- inc/caldav-REPORT-calquery.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 7904dd53..55765d9e 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -194,7 +194,7 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) { } if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { - $time_limit_clause = " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; + $time_limit_clause = " AND (CASE WHEN caldav_data.caldav_type<>'VEVENT' OR calendar_item.dtstart IS NULL THEN true ELSE calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') END) "; } } diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php index 9914d44a..03d80bea 100644 --- a/inc/caldav-REPORT-calquery.php +++ b/inc/caldav-REPORT-calquery.php @@ -339,7 +339,7 @@ if ( isset($c->hide_TODO) && $c->hide_TODO && ! $target_collection->HavePrivileg } if ( isset($c->hide_older_than) && intval($c->hide_older_than > 0) ) { - $where .= " AND calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') "; + $where .= " AND (CASE WHEN caldav_data.caldav_type<>'VEVENT' OR calendar_item.dtstart IS NULL THEN true ELSE calendar_item.dtstart > (now() - interval '".intval($c->hide_older_than)." days') END) "; } $sql = 'SELECT '.$distinct.' caldav_data.*,calendar_item.* FROM collection INNER JOIN caldav_data USING(collection_id) INNER JOIN calendar_item USING(dav_id) '. $where; -- 2.11.4.GIT