reset isDefault to 0 on copy, 8921
This commit is contained in:
parent
5e967d9b82
commit
913ed8ec26
3 changed files with 25 additions and 3 deletions
|
|
@ -33,7 +33,7 @@
|
|||
- fixed: Site Nav navigation template can now be used more than once per page
|
||||
- added: TextArea now supports "maxlength" attribute
|
||||
- added: DataForm can now run a workflow when an entry is added
|
||||
|
||||
- Fixed #8921: Duplicating templates through conventional methods maintains default template flag
|
||||
|
||||
7.6.1
|
||||
- changed: the list of extensions for the export system to pass through
|
||||
|
|
|
|||
|
|
@ -105,6 +105,22 @@ sub definition {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 duplicate
|
||||
|
||||
Subclass the duplicate method so that the isDefault flag is set to 0 on any
|
||||
copy.
|
||||
|
||||
=cut
|
||||
|
||||
sub duplicate {
|
||||
my $self = shift;
|
||||
my $newTemplate = $self->SUPER::duplicate;
|
||||
$newTemplate->update({isDefault => 0});
|
||||
return $newTemplate;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use Test::More tests => 11; # increment this value for each test you create
|
||||
use Test::More tests => 13; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -52,5 +52,11 @@ ok(exists $newList->{$template->getId}, 'Uncommitted template exists returned fr
|
|||
my $newList2 = WebGUI::Asset::Template->getList($session, 'WebGUI Test Template', "assetData.status='approved'");
|
||||
ok(!exists $newList2->{$template->getId}, 'extra clause to getList prevents uncommitted template from being displayed');
|
||||
|
||||
$template->purge;
|
||||
$template->update({isDefault=>1});
|
||||
is($template->get('isDefault'), 1, 'isDefault set to 1');
|
||||
my $templateCopy = $template->duplicate();
|
||||
is($templateCopy->get('isDefault'), 0, 'isDefault set to 0 on copy');
|
||||
|
||||
$template->purge;
|
||||
$templateCopy->purge;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue