Update attributes and macros test (#967)

This commit is contained in:
Xavier Guimard 2016-03-15 20:30:33 +00:00
parent 335ea349db
commit ac3ee4f6a2
2 changed files with 13 additions and 16 deletions

View File

@ -79,15 +79,13 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'form' => 'text',
'test' => sub {
my ( $val, $conf ) = @_;
if ( defined $conf->{'exportedVars'}{$val}
or defined $conf->{'macros'}{$val}
or $val eq '_timezone' )
{
return 1;
}
else {
return 1, "__unknownAttrOrMacro__: $val";
return 1
if defined $conf->{'macros'}{$val} or $val eq '_timezone';
foreach $_ ( keys %$conf ) {
return 1
if $_ =~ /exportedvars$/i and defined $conf->{$_}{$val};
}
return 1, "__unknownAttrOrMacro__: $val";
}
},
'longtext' => {

View File

@ -72,15 +72,14 @@ sub types {
form => 'text',
test => sub {
my ( $val, $conf ) = @_;
if ( defined $conf->{exportedVars}->{$val}
or defined $conf->{macros}->{$val}
or $val eq '_timezone' )
{
return 1;
}
else {
return ( 1, "__unknownAttrOrMacro__: $val" );
return 1
if ( defined $conf->{macros}->{$val} or $val eq '_timezone' );
foreach ( keys %$conf ) {
return 1
if ( $_ =~ /exportedvars$/i
and defined $conf->{$_}->{$val} );
}
return ( 1, "__unknownAttrOrMacro__: $val" );
},
},