Reportgenerator: Beim Listenexport als PDF kann das PDF auch direkt ausgedruckt werden.
[kivitendo-erp.git] / SL / Template.pm
index 27ebb36..8693580 100644 (file)
@@ -91,7 +91,7 @@ sub format_string {
                  '<pagebreak>',
                  '&', quotemeta("\n"),
                  '"', '\$', '%', '_', '#', quotemeta('^'),
-                 '{', '}',  '<', '>', '£', "\r"
+                 '{', '}',  '<', '>', '£', "\r", '±', '\xe1',
                  ],
      quotemeta("\\") => '\\textbackslash ',
      '<pagebreak>'   => '',
@@ -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;
 }
 
@@ -213,7 +217,9 @@ sub parse_foreach {
       $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,6 +616,37 @@ sub convert_to_pdf {
 }
 
 
+####
+#### PlainTextTemplate
+####
+
+package PlainTextTemplate;
+
+use vars qw(@ISA);
+
+@ISA = qw(LaTeXTemplate);
+
+sub new {
+  my $type = shift;
+
+  return $type->SUPER::new(@_);
+}
+
+sub format_string {
+  my ($self, $variable) = @_;
+
+  return $variable;
+}
+
+sub get_mime_type {
+  return "text/plain";
+}
+
+sub parse {
+}
+
+1;
+
 ####
 #### OpenDocumentTemplate
 ####
@@ -1305,16 +1342,17 @@ sub format_string {
 sub get_mime_type() {
   my ($self) = @_;
 
-  if ($self->{"form"}->{"format"} =~ /xml/i) {
+  if ($self->{"form"}->{"format"} =~ /elsterwinston/i) {
     return "application/xml ";
+  } elsif ($self->{"form"}->{"format"} =~ /elstertaxbird/i) {
+    return "application/x-taxbird";
   } else {
-    return "text/xml";
+    return "text";
   }
 }
 
 sub uses_temp_file {
-#  my ($self) = @_;
-  # no tempfile needet for XML Output
+  # tempfile needet for XML Output
   return 1;
 }