X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate.pm;h=e4e940ba2d2370b005cb03321f58d89eeb3e757a;hb=4311578257aa2e5808580def7e80a38d493646b0;hp=ef6204fa6f21515347ac251034f9003c4b8c7751;hpb=5235a5270c230c353a068a6c36d7668ea3806f51;p=kivitendo-erp.git diff --git a/SL/Template.pm b/SL/Template.pm index ef6204fa6..e4e940ba2 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -91,7 +91,7 @@ sub format_string { '', '&', quotemeta("\n"), '"', '\$', '%', '_', '#', quotemeta('^'), - '{', '}', '<', '>', '£', "\r" + '{', '}', '<', '>', '£', "\r", '±', '\xe1', ], quotemeta("\\") => '\\textbackslash ', '' => '', @@ -107,6 +107,8 @@ sub format_string { '>' => '$>$', '£' => '\pounds ', "\r" => "", + '±' => '$\pm$', + '\xe1' => '$\bullet$', quotemeta('^') => '\^\\', quotemeta("\n") => '\newline ' ); @@ -124,6 +126,8 @@ sub format_string { $variable =~ s/\$\<\$${key}\$\>\$(.*?)\$<\$\/${key}\$>\$/\\${new}\{$1\}/gi; } + $variable =~ s/[\x00-\x1f]//g; + return $variable; } @@ -196,7 +200,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 +214,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; @@ -610,7 +617,7 @@ sub convert_to_pdf { #### -#### HTMLTemplate +#### OpenDocumentTemplate #### package OpenDocumentTemplate; @@ -1258,4 +1265,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;