From 6634ba45debbd7371b8740592d9821ba5e58ff5d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 17 Feb 2015 13:37:03 +0100 Subject: [PATCH] =?utf8?q?SL::DB::CustomVariable:=20value()=20f=C3=BCr=20T?= =?utf8?q?yp=20'date'=20gefixt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bisher wurde schlicht das falsche Feld zurückgegeben: text_value. Nun wird eine Instanz von DateTime zurückgegeben, die auf den Tag getruncatet ist. --- SL/DB/CustomVariable.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SL/DB/CustomVariable.pm b/SL/DB/CustomVariable.pm index 560a2de6f..fb990b0ce 100644 --- a/SL/DB/CustomVariable.pm +++ b/SL/DB/CustomVariable.pm @@ -75,9 +75,11 @@ sub value { my $id = int($self->number_value); return $id ? SL::DB::Part->new(id => $id)->load() : undef; + } elsif ( $type eq 'date' ) { + return $self->timestamp_value->clone->truncate(to => 'day'); } - goto &text_value; # text, textfield, date and select + goto &text_value; # text, textfield and select } sub value_as_text { -- 2.20.1