From ce7a7394b5d2e63a8181caad378edadc60778cd5 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 10 Nov 2010 08:46:08 -0800 Subject: [PATCH] Handle assets that can't be instanciated in ExtendCalendarRecurrences. Fixes bug #11956. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm | 4 ++++ t/Workflow/Activity/ExtendCalendarRecurrences.t | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c93bf7084..d2ed21fb8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -4,6 +4,7 @@ - fixed #11952: Navigation template help error - fixed #11951: Privacy setting of new profile field - fixed #11947: PayPal does not register in-state sales taxes + - fixed #11956: ExtendCalenderRecurrence bug 7.10.4 - Added WebGUI::Fork api diff --git a/lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm b/lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm index 6df6e375b..e6d9c8ba6 100644 --- a/lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm +++ b/lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm @@ -165,6 +165,10 @@ sub processRecurrence { my ( $self, $recurId, $timeLimit ) = @_; my $eventId = $self->findLastEventId($recurId); my $event = WebGUI::Asset::Event->new( $self->session, $eventId ); + if (! $event) { + $self->session->log->warn("Unable to instanciate event with assetId $eventId"); + return 0; + } my $recur = $event->getRecurrence; my $start = $event->getDateTimeStart->truncate(to => 'day'); diff --git a/t/Workflow/Activity/ExtendCalendarRecurrences.t b/t/Workflow/Activity/ExtendCalendarRecurrences.t index 9c1762b31..5f8c6ca13 100644 --- a/t/Workflow/Activity/ExtendCalendarRecurrences.t +++ b/t/Workflow/Activity/ExtendCalendarRecurrences.t @@ -97,7 +97,7 @@ my $sql = q{ my $dates = $session->db->buildArrayRefOfHashRefs($sql, [$calendar->getId]); # 3 years at every other month (6 times) plus the one we started with -is(@$dates, 19) or diag Dumper $dates; +is(@$dates, 19, 'created right number of dates') or diag Dumper $dates; done_testing;