Event recurrence bug fixes.

This commit is contained in:
Graham Knop 2007-05-23 23:19:15 +00:00
parent 00f7940c74
commit 74c752c0ef
2 changed files with 19 additions and 10 deletions

View file

@ -1,4 +1,6 @@
7.4.0
- fix: old recurring events were not deleted when changing recurrence pattern
- fix: unable to remove recurrence on events

View file

@ -1419,23 +1419,30 @@ sub processPropertiesFromFormPost {
if (nfreeze(\%recurrence_new) ne nfreeze(\%recurrence_old)) {
# Delete all old events and create new ones
my $old_id = $self->get("recurId");
# Set the new recurrence pattern
my $new_id = $self->setRecurrence(\%recurrence_new);
return ["There is something wrong with your recurrence pattern."]
unless $new_id;
# Generate the new recurring events
$self->generateRecurringEvents();
# Set the new recurrence pattern
if (%recurrence_new) {
my $new_id = $self->setRecurrence(\%recurrence_new);
return ["There is something wrong with your recurrence pattern."]
unless $new_id;
# Generate the new recurring events
$self->generateRecurringEvents();
}
else {
$self->update({recurId => undef});
}
# Delete old events
my $events = $self->getLineage(["siblings"], {
if ($old_id) {
my $events = $self->getLineage(["siblings"], {
returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::Event'],
joinClass => 'WebGUI::Asset::Event',
whereClause => qq{Event.recurId = "$old_id" and Event.recurId <> NULL}, #without the <> NULL, it pulls in the recurId's
whereClause => qq{Event.recurId = "$old_id"},
});
$_->purge for @$events;
$_->purge for @$events;
}
}
else {
# TODO: Give users a form property to decide what events to update