X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate.pm;h=18b44d069288fac571c764dfa189ac71f2d69bde;hb=319c72e8738bbbfd457ae33dafd03ab8d5203a12;hp=d30b928869d5099f43a1f71d224d4a56d2dbe911;hpb=d9fcfd9a74e33b1e1b1f8411d878671cc42db2a5;p=kivitendo-erp.git diff --git a/SL/Template.pm b/SL/Template.pm index d30b92886..18b44d069 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -91,7 +91,7 @@ sub format_string { '', '&', quotemeta("\n"), '"', '\$', '%', '_', '#', quotemeta('^'), - '{', '}', '<', '>', '£', "\r" + '{', '}', '<', '>', '£', "\r", '±', ], quotemeta("\\") => '\\textbackslash ', '' => '', @@ -107,6 +107,7 @@ sub format_string { '>' => '$>$', '£' => '\pounds ', "\r" => "", + '±' => '$\pm$', quotemeta('^') => '\^\\', quotemeta("\n") => '\newline ' ); @@ -196,7 +197,7 @@ sub parse_foreach { # replace the special variables <%sumcarriedforward%> # and <%lastpage%> - my $psum = $form->format_amount($myconfig, $sum, 2); + my $psum = $form->format_amount($self->{"myconfig"}, $sum, 2); $pb =~ s/<%sumcarriedforward%>/$psum/g; $pb =~ s/<%lastpage%>/$current_page/g; @@ -210,9 +211,12 @@ sub parse_foreach { $current_line += $lines; } if ($i < scalar(@{$form->{"linetotal"}})) { - $sum += $form->parse_amount($myconfig, $form->{"linetotal"}->[$i]); + $sum += $form->parse_amount($self->{"myconfig"}, + $form->{"linetotal"}->[$i]); } - + + $form->{"cumulatelinetotal"}[$i] = $form->format_amount($self->{"myconfig"}, $sum, 2); + my $new_text = $self->parse_block($text, (@indices, $i)); return undef unless (defined($new_text)); $new_contents .= $start_tag . $new_text . $end_tag; @@ -1258,4 +1262,64 @@ sub uses_temp_file { return 1; } + +########################################################## +#### +#### XMLTemplate +#### +########################################################## + +package XMLTemplate; + +use vars qw(@ISA); + +@ISA = qw(HTMLTemplate); + +sub new { + #evtl auskommentieren + my $type = shift; + + return $type->SUPER::new(@_); +} + +sub format_string { + my ($self, $variable) = @_; + my $form = $self->{"form"}; + + my %replace = + ('order' => ['<', '>', quotemeta("\n")], + '<' => '<', + '>' => '>', + quotemeta("\n") => '
', + ); + + map({ $variable =~ s/$_/$replace{$_}/g; } @{ $replace{"order"} }); + + # Allow no markup to be converted into the output format + my @markup_replace = ('b', 'i', 's', 'u', 'sub', 'sup'); + + foreach my $key (@markup_replace) { + $variable =~ s/\<(\/?)${key}\>//g; + } + + return $variable; +} + +sub get_mime_type() { + my ($self) = @_; + + if ($self->{"form"}->{"format"} =~ /elsterwinston/i) { + return "application/xml "; + } elsif ($self->{"form"}->{"format"} =~ /elstertaxbird/i) { + return "application/x-taxbird"; + } else { + return "text"; + } +} + +sub uses_temp_file { + # tempfile needet for XML Output + return 1; +} + 1;