diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6936bed60..6881e7628 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -17,6 +17,7 @@ - intalled YUI fix for flash files. - fixed #11932: Bad URL in the newly templated recover password email - fixed #11938: upgrade script always removes specialState + - fixed #11937: Duplicating events does not duplicate storage locations 7.10.3 - fixed #11903: Unnecessary debug in Thingy diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index 8c8b42ef6..1aac333c8 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -360,6 +360,22 @@ sub canEdit { #------------------------------------------------------------------- +=head2 duplicate ( ) + +Extend the super class to duplicate the storage location. + +=cut + +sub duplicate { + my $self = shift; + my $newAsset = $self->SUPER::duplicate(@_); + my $newStorage = $self->getStorageLocation->copy; + $newAsset->update({storageId=>$newStorage->getId}); + return $newAsset; +} + +#------------------------------------------------------------------- + =head2 generateRecurrence (date) Creates an recurrence event in the parent calendar for the given date diff --git a/t/Asset/Event.t b/t/Asset/Event.t index 93cf60e8b..ddafe0e8b 100644 --- a/t/Asset/Event.t +++ b/t/Asset/Event.t @@ -19,7 +19,7 @@ use WebGUI::Asset::Event; use Test::More; # increment this value for each test you create use Test::Deep; -plan tests => 22; +plan tests => 23; my $session = WebGUI::Test->session; @@ -143,3 +143,13 @@ is ($event7->get('startDate'), '2000-09-01', 'startDate bumped by 1 day'); is ($event7->get('endTime'), '00:00:00', 'endTime set to 00:00:00 if the hour is more than 23'); is ($event7->get('endDate'), '2000-09-02', 'endDate bumped by 1 day'); + +####################################### +# +# duplicate +# +####################################### + + +my $event6b = $event6->duplicate(); +isnt($event6b->get('storageId'), $event6->get('storageId'), 'duplicating an asset creates a new storage location');