login nicht aus $::form nehmen. Teil 1
[kivitendo-erp.git] / SL / Template / Simple.pm
index be5ba8b..c525dab 100644 (file)
@@ -30,12 +30,16 @@ sub new {
 }
 
 sub _init {
-  my $self = shift;
+  my ($self, %params) = @_;
+
+  $params{myconfig}  ||= \%::myconfig;
+  $params{userspath} ||= $::lx_office_conf{paths}->{userspath};
+
+  $self->{$_} = $params{$_} for keys %params;
 
-  $self->{source}    = shift;
-  $self->{form}      = shift;
-  $self->{myconfig}  = shift;
-  $self->{userspath} = shift;
+  $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}   = '"';
@@ -138,7 +142,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);
   }