Calendar - change iCal import purge filter from date range to number of days in the past/future

This commit is contained in:
nathangray 2018-04-03 10:05:36 -06:00
parent 3a6b2ce630
commit 40b67e6875
4 changed files with 30 additions and 29 deletions

View File

@ -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'])

View File

@ -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']];
}
}

View File

@ -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.

View File

@ -3,11 +3,14 @@
<!-- $Id$ -->
<overlay>
<template id="calendar.import.ical_conditions" template="" lang="" group="0" version="16.1">
<template id="importexport.wizard_basic_import_csv.conditions" disabled="@no_conditions"/>
<hbox>
<description value="Do not import conflicting events"/>
<checkbox id="skip_conflicts" />
</hbox>
<filter id="set_filter" relative_dates="true"/>
<vbox>
<template id="importexport.wizard_basic_import_csv.conditions" disabled="@no_conditions"/>
<hbox>
<description value="Do not import conflicting events"/>
<checkbox id="skip_conflicts" />
</hbox>
<integer label="How many days to be removed in the past (default 100)" id="remove_past"/>
<integer label="How many days to be removed in the future (default 365)" id="remove_future"/>
</vbox>
</template>
</overlay>