X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/a9d8dd12a6dfa8f00b039e53d338cd60b8ccd031..14de4f7cc44ebf65b4e68c95c3638c3e9d94df7c:/SL/DB/CustomVariable.pm diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index dd68cab3e..60955e40f 100644 --- a/SL/DB/CustomVariable.pm +++ b/SL/DB/CustomVariable.pm @@ -4,10 +4,7 @@ package SL::DB::CustomVariable; use strict; - use SL::DB::MetaSetup::CustomVariable; -use SL::DB::CustomVariableValidity; -use SL::DB::Customer; __PACKAGE__->meta->initialize; @@ -22,10 +19,12 @@ sub value { goto ×tamp_value if $type eq 'timestamp'; goto &number_value if $type eq 'number'; if ( $type eq 'customer' ) { - if ( defined($_[1]) ) { + if ( defined($_[1]) && $_[1] ) { goto &number_value; } else { + require SL::DB::Customer; + my $id = int($self->number_value); return $id ? SL::DB::Customer->new(id => $id)->load() : 0; } @@ -36,7 +35,10 @@ sub value { sub is_valid { my ($self) = @_; - return SL::DB::Manager::CustomVariableValidity->get_all_count(config_id => $self->config_id, trans_id => $self->trans_id) == 0; + require SL::DB::CustomVariableValidity; + + my $query = [config_id => $self->config_id, trans_id => $self->trans_id]; + return SL::DB::Manager::CustomVariableValidity->get_all_count(query => $query) == 0; } 1;