Fix how update and addRevision handle defaults from the definition subroutine
when it returns an array ref.
This commit is contained in:
parent
c7fcd40a25
commit
c6e9d322a8
4 changed files with 10 additions and 1 deletions
|
|
@ -20,6 +20,7 @@
|
|||
- fixed: Getting an i18n key from a file that does not exist.
|
||||
- fixed: Tree Navigation menu shows level numbers
|
||||
- fixed: loginBox macro no longer can return user to "logout" page, logging them out
|
||||
- fixed: Template Assets broken
|
||||
|
||||
7.5.20
|
||||
- fixed: DataForm acknowledgement screen shows incorrect value for Date/Time fields
|
||||
|
|
|
|||
|
|
@ -2270,6 +2270,9 @@ sub update {
|
|||
# use the default value because default and update were both undef
|
||||
if ($value eq "" && exists $definition->{properties}{$property}{defaultValue}) {
|
||||
$value = $definition->{properties}{$property}{defaultValue};
|
||||
if (ref($value) eq 'ARRAY') {
|
||||
$value = $value->[0];
|
||||
}
|
||||
}
|
||||
|
||||
# set the property
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ sub addRevision {
|
|||
# get the default values of each property
|
||||
foreach my $property (keys %{$definition->{properties}}) {
|
||||
$defaults{$property} = $definition->{properties}{$property}{defaultValue};
|
||||
if (ref($defaults{$property}) eq 'ARRAY') {
|
||||
$defaults{$property} = $defaults{$property}->[0];
|
||||
}
|
||||
}
|
||||
|
||||
# prime the tables
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use Test::More tests => 10; # increment this value for each test you create
|
||||
use Test::More tests => 11; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -38,6 +38,8 @@ my $importNode = WebGUI::Asset::Template->getImportNode($session);
|
|||
my $template = $importNode->addChild({className=>"WebGUI::Asset::Template", title=>"test", url=>"testingtemplates", template=>$template, namespace=>'WebGUI Test Template'});
|
||||
isa_ok($template, 'WebGUI::Asset::Template', "creating a template");
|
||||
|
||||
is($template->get('parser'), 'WebGUI::Asset::Template::HTMLTemplate', 'default parser is HTMLTemplate');
|
||||
|
||||
$var{variable} = "BBBBB";
|
||||
$output = $template->process(\%var);
|
||||
ok($output =~ m/\bBBBBB\b/, "process() - variables");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue