diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 2a040cf7..4acd8d46 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -192,7 +192,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;