X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/d9fcfd9a74e33b1e1b1f8411d878671cc42db2a5..aa1102e99b95c7ffc7bfb0078af520429595b702:/SL/Template.pm diff --git a/SL/Template.pm b/SL/Template.pm index d30b92886..c7257e991 100644 --- a/SL/Template.pm +++ b/SL/Template.pm @@ -196,7 +196,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 +210,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 +1261,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;