X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCVar.pm;h=1b83121bf0340584968cbfdbd90445da4576ba6b;hb=02cb7e02771247f3106001076366d119277a7d30;hp=2408222782c2ab8a13b0e573a2336415ccf1723e;hpb=db7c3a525af246d3373e63b4e8b5b7edc82b0a9f;p=kivitendo-erp.git diff --git a/SL/CVar.pm b/SL/CVar.pm index 240822278..1b83121bf 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -575,7 +575,7 @@ sub add_custom_variables_to_report { $cfg->{type} eq 'date' ? $ref->{date_value} : $cfg->{type} eq 'timestamp' ? $ref->{timestamp_value} : $cfg->{type} eq 'number' ? $form->format_amount($myconfig, $ref->{number_value} * 1, $cfg->{precision}) - : $cfg->{type} eq 'customer' ? SL::DB::Manager::Customer->find_by(id => 1* $ref->{number_value})->name + : $cfg->{type} eq 'customer' ? (SL::DB::Manager::Customer->find_by(id => 1*$ref->{number_value}) || SL::DB::Customer->new)->name : $cfg->{type} eq 'bool' ? ($ref->{bool_value} ? $locale->text('Yes') : $locale->text('No')) : $ref->{text_value}; } @@ -716,6 +716,16 @@ sub parse { return $value; } +sub format_to_template { + my ($self, $value, $config) = @_; + # stupid template expects everything formated. except objects + # do not use outside of print routines for legacy templates + + return $::form->parse_amount(\%::myconfig, $value) if $config->{type} eq 'number'; + return $value->to_lxoffice if $config->{type} eq 'date' && blessed $value && $value->can('to_lxoffice'); + return $value; +} + 1; __END__