From: Thomas Heck Date: Mon, 24 Jun 2013 08:33:08 +0000 (+0200) Subject: SL::DB::CustomVariable::value an Customer angepasst X-Git-Tag: release-3.1.0beta1~161^2^2~37 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c1f509ea8c0b8d9f785a7bc1672556022526ea47;p=kivitendo-erp.git SL::DB::CustomVariable::value an Customer angepasst als getter gibt die Methode ein SL::DB::Customer-Objekt zurück. als setter wird eine Customer-ID erwartet. --- diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index 83ee89db7..dd68cab3e 100644 --- a/SL/DB/CustomVariable.pm +++ b/SL/DB/CustomVariable.pm @@ -7,6 +7,7 @@ use strict; use SL::DB::MetaSetup::CustomVariable; use SL::DB::CustomVariableValidity; +use SL::DB::Customer; __PACKAGE__->meta->initialize; @@ -20,6 +21,15 @@ sub value { goto &bool_value if $type eq 'boolean'; goto ×tamp_value if $type eq 'timestamp'; goto &number_value if $type eq 'number'; + if ( $type eq 'customer' ) { + if ( defined($_[1]) ) { + goto &number_value; + } + else { + my $id = int($self->number_value); + return $id ? SL::DB::Customer->new(id => $id)->load() : 0; + } + } goto &text_value; # text and select }