From c1f509ea8c0b8d9f785a7bc1672556022526ea47 Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Mon, 24 Jun 2013 10:33:08 +0200 Subject: [PATCH] SL::DB::CustomVariable::value an Customer angepasst MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit als getter gibt die Methode ein SL::DB::Customer-Objekt zurück. als setter wird eine Customer-ID erwartet. --- SL/DB/CustomVariable.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 } -- 2.20.1