From 3e466ad1ea3380b6dca3e8cd33827a2ef8039a75 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 16 Jan 2014 13:21:28 +0100 Subject: [PATCH] SL::Template: Optionen von den Contrllern zum eigentlichen Template-Modul durchleiten --- SL/Form.pm | 3 ++- SL/Template/Simple.pm | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 0d6e9ae9a..ed31ddf68 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1019,7 +1019,8 @@ sub parse_template { file_name => $self->{IN}, form => $self, myconfig => $myconfig, - userspath => $userspath); + userspath => $userspath, + %{ $self->{TEMPLATE_DRIVER_OPTIONS} || {} }); # Copy the notes from the invoice/sales order etc. back to the variable "notes" because that is where most templates expect it to be. $self->{"notes"} = $self->{ $self->{"formname"} . "notes" }; diff --git a/SL/Template/Simple.pm b/SL/Template/Simple.pm index 8696796bc..a4b98ca71 100644 --- a/SL/Template/Simple.pm +++ b/SL/Template/Simple.pm @@ -34,6 +34,10 @@ sub _init { $self->{$_} = $params{$_} for keys %params; + $self->{variable_content_types} ||= {}; + $self->{variable_content_types}->{$_} = lc $self->{variable_content_types}->{$_} for keys %{ $self->{variable_content_types} }; + $self->{default_variable_content_type} = 'text'; + $self->{error} = undef; $self->{quot_re} = '"'; @@ -135,7 +139,7 @@ sub substitute_vars { my $value = $self->_get_loop_variable($var, 0, @indices); $value = $form->parse_amount({ numberformat => $::myconfig{output_numberformat} || $::myconfig{numberformat} }, $value) if $options{NOFORMAT}; - $value = $self->format_string($value) unless $options{NOESCAPE}; + $value = $self->format_string($value, $var) unless $options{NOESCAPE}; substr($text, $tag_pos, $tag_len, $value); } -- 2.20.1