X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/c1f509ea8c0b8d9f785a7bc1672556022526ea47..9e228847e12d3094685049e3c8c69fd173853f7b:/SL/DB/CustomVariable.pm diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index dd68cab3e..edc595ce4 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,6 +35,8 @@ sub value { sub is_valid { my ($self) = @_; + require SL::DB::CustomVariableValidity; + return SL::DB::Manager::CustomVariableValidity->get_all_count(config_id => $self->config_id, trans_id => $self->trans_id) == 0; }