From: Moritz Bunkus Date: Fri, 15 Jun 2007 06:18:53 +0000 (+0000) Subject: Durch das Verschieben der Headerausgabe beim PDF-Export wurde der Name des Attachment... X-Git-Tag: release-2.4.3^2~115 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ecb5cd9f06effc579acb3337c31e278f5a35d7b3;p=kivitendo-erp.git Durch das Verschieben der Headerausgabe beim PDF-Export wurde der Name des Attachments nicht richtig gesetzt (jeweils nur '.pdf'). Fix für Bug 681. --- diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index 4a48dfd84..59a878baf 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -158,6 +158,15 @@ sub set_export_options { }; } +sub get_attachment_basename { + my $self = shift; + my $filename = $self->{options}->{attachment_basename} || 'report'; + $filename =~ s|.*\\||; + $filename =~ s|.*/||; + + return $filename; +} + sub generate_with_headers { my $self = shift; my $format = lc $self->{options}->{output_format}; @@ -167,10 +176,6 @@ sub generate_with_headers { $form->error('Incorrect usage -- no columns specified'); } - my $filename = $self->{options}->{attachment_basename} || 'report'; - $filename =~ s|.*\\||; - $filename =~ s|.*/||; - if ($format eq 'html') { my $title = $form->{title}; $form->{title} = $self->{title} if ($self->{title}); @@ -180,6 +185,7 @@ sub generate_with_headers { print $self->generate_html_content(); } elsif ($format eq 'csv') { + my $filename = $self->get_attachment_basename(); print qq|content-type: text/csv\n|; print qq|content-disposition: attachment; filename=${filename}.csv\n\n|; $self->generate_csv_content(); @@ -385,6 +391,7 @@ END my $content; if (!$printer_command) { + my $filename = $self->get_attachment_basename(); print qq|content-type: application/pdf\n|; print qq|content-disposition: attachment; filename=${filename}.pdf\n\n|;