From ecb5cd9f06effc579acb3337c31e278f5a35d7b3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 15 Jun 2007 06:18:53 +0000 Subject: [PATCH] =?utf8?q?Durch=20das=20Verschieben=20der=20Headerausgabe?= =?utf8?q?=20beim=20PDF-Export=20wurde=20der=20Name=20des=20Attachments=20?= =?utf8?q?nicht=20richtig=20gesetzt=20(jeweils=20nur=20'.pdf').=20Fix=20f?= =?utf8?q?=C3=BCr=20Bug=20681.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/ReportGenerator.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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|; -- 2.20.1