Beim Verschicken von Sammelrechnungen per Email einen besseren Namen für den Dateianh...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Apr 2007 13:03:01 +0000 (13:03 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 18 Apr 2007 13:03:01 +0000 (13:03 +0000)
bin/mozilla/rp.pl

index 8156df0..152db95 100644 (file)
@@ -2003,21 +2003,33 @@ sub print {
 sub print_form {
   $lxdebug->enter_sub();
 
+  my %replacements =
+    (
+     "ä" => "ae", "ö" => "oe", "ü" => "ue",
+     "Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue",
+     "ß" => "ss",
+     " " => "_"
+    );
+
   $form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
 
   $form->{templates} = "$myconfig{templates}";
 
-  $form->{IN} = "$form->{type}.html";
-
+  my $suffix = "html";
+  my $attachment_suffix = "html";
   if ($form->{format} eq 'postscript') {
     $form->{postscript} = 1;
-    $form->{IN} =~ s/html$/tex/;
-  }
-  if ($form->{format} eq 'pdf') {
+    $suffix = "tex";
+    $attachment_suffix = "ps";
+  } elsif ($form->{format} eq 'pdf') {
     $form->{pdf} = 1;
-    $form->{IN} =~ s/html$/tex/;
+    $suffix = "tex";
+    $attachment_suffix = "pdf";
   }
 
+  $form->{IN} = "$form->{type}.$suffix";
+
+
   # Save $form->{email} because it will be overwritten.
   $form->{EMAIL_RECIPIENT} = $form->{email};
 
@@ -2077,6 +2089,9 @@ sub print_form {
             $form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
         } (c0, c30, c60, c90, "");
 
+        $form->{attachment_filename} = $locale->text("Statement") . "_$form->{todate}.$attachment_suffix";
+        map({ $form->{attachment_filename} =~ s/$_/$replacements{$_}/g; } keys(%replacements));
+
         $form->parse_template(\%myconfig, $userspath);
 
       }