Fix how update and addRevision handle defaults from the definition subroutine

when it returns an array ref.
This commit is contained in:
Colin Kuskie 2008-08-19 22:03:39 +00:00
parent c7fcd40a25
commit c6e9d322a8
4 changed files with 10 additions and 1 deletions

View file

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

View file

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