Make a new storage location when an Event is duplicated. Fixes bug #11937.

This commit is contained in:
Colin Kuskie 2010-11-01 09:19:08 -07:00
parent 1c63a65377
commit 04ec75719e
3 changed files with 28 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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');