mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 05:16:45 +00:00
57_Calendar: cutoffOlderThan also removes recurring events when the series has ended.
git-svn-id: https://svn.fhem.de/fhem/trunk@17421 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6fbed78449
commit
360e06f3b2
@ -96,9 +96,12 @@ my %functions_set = ( "on" => 0,
|
|||||||
"dimto" => 1,
|
"dimto" => 1,
|
||||||
"on-till" => 1,
|
"on-till" => 1,
|
||||||
"on-for-timer" => 1,
|
"on-for-timer" => 1,
|
||||||
|
"all_units_off" => 0,
|
||||||
|
"all_units_on" => 0,
|
||||||
|
"all_lights_off" => 0,
|
||||||
|
"all_lights_on" => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
my %models = (
|
my %models = (
|
||||||
lm12 => 'dimmer',
|
lm12 => 'dimmer',
|
||||||
lm15 => 'switch',
|
lm15 => 'switch',
|
||||||
|
@ -2814,12 +2814,24 @@ sub Calendar_UpdateCalendar($$) {
|
|||||||
foreach my $v (grep { $_->{type} eq "VEVENT" } @{$root->{entries}}) {
|
foreach my $v (grep { $_->{type} eq "VEVENT" } @{$root->{entries}}) {
|
||||||
|
|
||||||
# totally skip outdated calendar entries
|
# totally skip outdated calendar entries
|
||||||
|
if($cutoffOlderThan) {
|
||||||
|
if(!$v->isRecurring()) {
|
||||||
|
# non recurring event
|
||||||
next if(
|
next if(
|
||||||
defined($cutoffOlderThan) &&
|
defined($cutoffOlderThan) &&
|
||||||
$v->hasKey("DTEND") &&
|
$v->hasKey("DTEND") &&
|
||||||
$v->tm($v->value("DTEND")) < $cutoff &&
|
$v->tm($v->value("DTEND")) < $cutoff
|
||||||
!$v->hasKey("RRULE")
|
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
# recurring event, inspect
|
||||||
|
my $rrule= $v->value("RRULE");
|
||||||
|
my @rrparts= split(";", $rrule);
|
||||||
|
my %r= map { split("=", $_); } @rrparts;
|
||||||
|
if(exists($r{"UNTIL"})) {
|
||||||
|
next if($v->tm($r{"UNTIL"}) < $cutoff)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#main::Debug "Merging " . $v->asString();
|
#main::Debug "Merging " . $v->asString();
|
||||||
my $found= 0;
|
my $found= 0;
|
||||||
@ -3493,10 +3505,10 @@ sub CalendarEventsAsHtml($;$) {
|
|||||||
<p>
|
<p>
|
||||||
|
|
||||||
<li><code>cutoffOlderThan <timespec></code><br>
|
<li><code>cutoffOlderThan <timespec></code><br>
|
||||||
This attribute cuts off all non-recurring calendar events that ended a timespan cutoffOlderThan
|
This attribute cuts off all calendar events that ended a timespan cutoffOlderThan
|
||||||
before the last update of the calendar. The purpose of setting this attribute is to save memory.
|
before the last update of the calendar. The purpose of setting this attribute is to save memory.
|
||||||
Such calendar events cannot be accessed at all from FHEM. Calendar events are not cut off if
|
Such calendar events cannot be accessed at all from FHEM. Calendar events are not cut off if
|
||||||
they are recurring or if they have no end time (DTEND).
|
they are recurring with no end of series (UNTIL) or if they have no end time (DTEND).
|
||||||
</li><p>
|
</li><p>
|
||||||
|
|
||||||
<li><code>onCreateEvent <perl-code></code><br>
|
<li><code>onCreateEvent <perl-code></code><br>
|
||||||
@ -3952,9 +3964,10 @@ sub CalendarEventsAsHtml($;$) {
|
|||||||
<p>
|
<p>
|
||||||
|
|
||||||
<li><code>cutoffOlderThan <timespec></code><br>
|
<li><code>cutoffOlderThan <timespec></code><br>
|
||||||
Dieses Attribut schneidet alle nicht wiederkehrenden Termine weg, die eine Zeitspanne cutoffOlderThan
|
Dieses Attribut schneidet alle Termine weg, die eine Zeitspanne cutoffOlderThan
|
||||||
vor der letzten Aktualisierung des Kalenders endeten. Der Zweck dieses Attributs ist es Speicher zu
|
vor der letzten Aktualisierung des Kalenders endeten. Der Zweck dieses Attributs ist es Speicher zu
|
||||||
sparen. Auf solche Termine kann gar nicht mehr aus FHEM heraus zugegriffen werden. Serientermine und
|
sparen. Auf solche Termine kann gar nicht mehr aus FHEM heraus zugegriffen
|
||||||
|
werden. Serientermine ohne Ende (UNTIL) und
|
||||||
Termine ohne Endezeitpunkt (DTEND) werden nicht weggeschnitten.
|
Termine ohne Endezeitpunkt (DTEND) werden nicht weggeschnitten.
|
||||||
</li><p>
|
</li><p>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user