From 40b67e6875de19597bed102249d6bebf97472245 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 3 Apr 2018 10:05:36 -0600 Subject: [PATCH] Calendar - change iCal import purge filter from date range to number of days in the past/future --- .../inc/class.calendar_import_ical.inc.php | 14 +++++++++- .../class.calendar_wizard_import_ical.inc.php | 27 ++++--------------- calendar/lang/egw_en.lang | 3 +++ .../default/import.ical_conditions.xet | 15 ++++++----- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/calendar/inc/class.calendar_import_ical.inc.php b/calendar/inc/class.calendar_import_ical.inc.php index 1c04b45a29..610cf730c7 100644 --- a/calendar/inc/class.calendar_import_ical.inc.php +++ b/calendar/inc/class.calendar_import_ical.inc.php @@ -11,6 +11,7 @@ * @version $Id$ */ +use \EGroupware\Api; /** * import ical for calendar @@ -143,7 +144,18 @@ class calendar_import_ical implements importexport_iface_import_plugin { $owner = $plugin_options['cal_owner']; // Purge - $this->purge_calendar($owner, $_definition->filter['purge'], $plugin_options['no_notification']); + $remove_past = new Api\DateTime(); + $remove_future = new Api\DateTime(); + $plugin_options = array_merge(array('remove_past' => 100, 'remove_future' => 365), $plugin_options); + foreach(array('remove_past','remove_future') as $date) + { + ${$date}->add( (($date == 'remove_past' ? -1 : 1) * (int)$plugin_options[$date]) . ' days'); + } + $this->purge_calendar( + $owner, + array('from' => $remove_past, 'to' => $remove_future), + $plugin_options['no_notification'] + ); // User wants conflicting events to not be imported if($_definition->plugin_options['skip_conflicts']) diff --git a/calendar/inc/class.calendar_wizard_import_ical.inc.php b/calendar/inc/class.calendar_wizard_import_ical.inc.php index a3e1d2d805..2dfc3cdaff 100644 --- a/calendar/inc/class.calendar_wizard_import_ical.inc.php +++ b/calendar/inc/class.calendar_wizard_import_ical.inc.php @@ -53,16 +53,6 @@ class calendar_wizard_import_ical // return from step55 if ($content['step'] == 'wizard_step55') { - unset($content['filter']); - unset($content['set_filter']['fields']); - foreach($content['set_filter'] as $key => $value) - { - if($value) { - $content['filter'][$key] = $value; - } - } - unset($content['set_filter']); - switch (array_search('pressed', $content['button'])) { case 'next': @@ -80,9 +70,12 @@ class calendar_wizard_import_ical { $content['text'] = $this->steps['wizard_step55']; $content['step'] = 'wizard_step55'; - if(!$content['skip_conflicts'] && array_key_exists('skip_conflicts', $content['plugin_options'])) + foreach(array('skip_conflicts','remove_past','remove_future') as $field) { - $content['skip_conflicts'] = $content['plugin_options']['skip_conflicts']; + if(!$content[$field] && array_key_exists($field, $content['plugin_options'])) + { + $content[$field] = $content['plugin_options'][$field]; + } } $preserv = $content; unset ($preserv['button']); @@ -90,16 +83,6 @@ class calendar_wizard_import_ical // No real conditions, but we share a template $content['no_conditions'] = true; - // Filter - Purge - $content['set_filter']['fields'] = importexport_helper_functions::get_filter_fields( - $content['application'],$content['plugin'],$this - ); - // Load existing filter from either content or definition - foreach($content['set_filter']['fields'] as $field => $settings) - { - $content['set_filter'][$field] = $content['filter'][$field]; - } - return $this->step_templates[$content['step']]; } } diff --git a/calendar/lang/egw_en.lang b/calendar/lang/egw_en.lang index aa71896a7f..eaff447884 100644 --- a/calendar/lang/egw_en.lang +++ b/calendar/lang/egw_en.lang @@ -164,6 +164,7 @@ display status of events calendar en Display status of events displayed view calendar en Displayed view displays this calendar view on the home page (page you get when you enter egroupware or click on the home page icon)? calendar en Displays this calendar view on the home page, the page you get when you enter EGroupware or click on the home page icon? distribution list calendar en Distribution list +do not import conflicting events calendar en Do not import conflicting events do not include events of group members calendar en Do not include events of group members do you really want to change the start of this series? if you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created. calendar en Do you really want to change the start of this series? If you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created. do you want a weekview with or without weekend? calendar en Do you want a weekview with or without weekend? @@ -274,6 +275,8 @@ holidays only calendar en Holidays only hours calendar en hours how far to search (from startdate) calendar en How far to search (from start date) how many appointments should non-admins be able to export admin en How many appointments should non-admins be able to export. +how many days to be removed in the future (default 365) calendar en How many days to be removed in the future (default 365) +how many days to be removed in the past (default 100) calendar en How many days to be removed in the past (default 100) how many days to sync in the future (default %1) calendar en How many days to sync in the future (default %1) how many days to sync in the past (default %1) calendar en How many days to sync in the past (default %1) how many description lines should be directly visible. further lines are available via a scrollbar. calendar en How many description lines should be directly visible. Further lines are available via a scroll bar. diff --git a/calendar/templates/default/import.ical_conditions.xet b/calendar/templates/default/import.ical_conditions.xet index 791748408b..827609b4e4 100644 --- a/calendar/templates/default/import.ical_conditions.xet +++ b/calendar/templates/default/import.ical_conditions.xet @@ -3,11 +3,14 @@