bug fixes
This commit is contained in:
parent
81c42d7296
commit
908200869e
3 changed files with 16 additions and 5 deletions
|
|
@ -1568,8 +1568,9 @@ sub new {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined $properties) {
|
if (defined $properties) {
|
||||||
my $object = { _session=>$session, _properties => $properties };
|
my $object = $class->instantiate;
|
||||||
bless $object, $class;
|
$object->{_session} = $session;
|
||||||
|
$object->{_properties} = $properties;
|
||||||
foreach my $property ($object->getProperties) {
|
foreach my $property ($object->getProperties) {
|
||||||
my $definition = $object->getProperty($property);
|
my $definition = $object->getProperty($property);
|
||||||
if ($definition->{serialize} && $object->{_properties}->{$property} ne '') {
|
if ($definition->{serialize} && $object->{_properties}->{$property} ne '') {
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ sub import {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub _build {
|
sub _build {
|
||||||
my ($class, $super, $caller, $definition) = @_;
|
my ($class, $super, $caller, $definition) = @_;
|
||||||
|
$class->next::method($super, $caller, $definition);
|
||||||
$class->_install($super, 'getTables', $class->_gen_getTables());
|
$class->_install($super, 'getTables', $class->_gen_getTables());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,12 +69,16 @@ sub _gen_getTables {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
return sub {
|
return sub {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my %tables;
|
my %found;
|
||||||
|
my @tables;
|
||||||
foreach my $property ($self->getProperties) {
|
foreach my $property ($self->getProperties) {
|
||||||
my $definition = $self->getProperty($property);
|
my $definition = $self->getProperty($property);
|
||||||
$tables{$definition->{tableName}} = 1;
|
unless ($found{$definition->{tableName}}) {
|
||||||
|
push @tables, $definition->{tableName};
|
||||||
|
}
|
||||||
|
$found{$definition->{tableName}} = 1;
|
||||||
}
|
}
|
||||||
return keys %tables;
|
return @tables;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ use WebGUI::Test;
|
||||||
|
|
||||||
my $object = WGT::Class->instantiate;
|
my $object = WGT::Class->instantiate;
|
||||||
|
|
||||||
|
can_ok($object, 'getTables');
|
||||||
|
my @tables = $object->getTables;
|
||||||
|
is $tables[0], 'mytable', 'found first table';
|
||||||
|
is $tables[1], 'othertable', 'found second table';
|
||||||
|
|
||||||
is $object->getProperty('showInForms')->{tableName}, 'mytable',
|
is $object->getProperty('showInForms')->{tableName}, 'mytable',
|
||||||
'properties copy tableName attribute';
|
'properties copy tableName attribute';
|
||||||
is $object->getProperty('confirmChange')->{tableName}, 'othertable',
|
is $object->getProperty('confirmChange')->{tableName}, 'othertable',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue