Do not extend recurrent for events in the trash. Do not extend them in the clipboard either, since it'll either make a mess in the clipboard or pop them up on the calendar automatically. Fixes bug #11995

This commit is contained in:
Colin Kuskie 2011-01-03 17:24:29 -08:00
parent b911f05125
commit a083737ab3
3 changed files with 41 additions and 2 deletions

View file

@ -15,6 +15,7 @@
- fixed #12012: WebGUI Account system does not present login to visitors for proper redirect
- fixed #12015: Thingy: Custom 'File' form fields get deleted upon save
- fixed #11994: recurring calendar entries
- fixed #11995: recurring calendar entries in trash
7.10.6
- fixed #11974: Toolbar icons unclickable in Webkit using HTML5

View file

@ -170,6 +170,11 @@ sub processRecurrence {
$self->session->log->warn("Unable to instanciate event with assetId $eventId");
return 0;
}
##Ignore assets in the trash. Same with assets in the clipboard since they would not be
##put into the clipboard.
if ($event->get('state') ne 'published') {
return 0;
}
my $recur = $event->getRecurrence;
my $versionTag = WebGUI::VersionTag->create($self->session, {name => 'Extend Calendar Recurrence for assetId '.$event->getId, });

View file

@ -41,9 +41,26 @@ my $event = $calendar->addChild(
}, undef, undef, {skipAutoCommitWorkflows => 1, }
);
my $trashed_event = $calendar->addChild(
{ className => 'WebGUI::Asset::Event',
startDate => $one_year_ago,
endDate => $one_year_ago,
}, undef, undef, {skipAutoCommitWorkflows => 1, }
);
$trashed_event->trash;
my $clipped_event = $calendar->addChild(
{ className => 'WebGUI::Asset::Event',
startDate => $one_year_ago,
endDate => $one_year_ago,
}, undef, undef, {skipAutoCommitWorkflows => 1, }
);
$clipped_event->cut;
$tag->commit;
$calendar = $calendar->cloneFromDb;
$event = $event->cloneFromDb;
foreach my $asset($calendar, $event, $clipped_event, $trashed_event) {
$asset = $asset->cloneFromDb;
}
my $recurId = $event->setRecurrence(
{ recurType => 'monthDay',
@ -53,6 +70,22 @@ my $recurId = $event->setRecurrence(
}
);
$trashed_event->setRecurrence(
{ recurType => 'monthDay',
every => 2,
startDate => $trashed_event->get('startDate'),
dayNumber => $eventStartDate->day,
}
);
$clipped_event->setRecurrence(
{ recurType => 'monthDay',
every => 2,
startDate => $clipped_event->get('startDate'),
dayNumber => $eventStartDate->day,
}
);
my $workflow = WebGUI::Workflow->create(
$session, {
enabled => 1,