X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FReportGenerator.pm;h=2d959509d05c47f9e18b66497c8261f196e52668;hb=9de83d1a34f29dbf2f0ea4f2b4230913461c05db;hp=f5550a62d104cdcb0434107ad387e97ca5e53daf;hpb=389007ac0512ed52a2a9bf1bf46f680b5fbb7f57;p=kivitendo-erp.git diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index f5550a62d..2d959509d 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -1,10 +1,14 @@ package SL::ReportGenerator; +#use strict; + use Encode; use IO::Wrap; use List::Util qw(max); use Text::CSV_XS; use Text::Iconv; +#use PDF::API2; # these two eat up to .75s on startup. only load them if we actually need them +#use PDF::Table; use SL::Form; @@ -271,6 +275,7 @@ sub prepare_html_content { my $header = { 'name' => $name, + 'align' => $column->{align}, 'link' => $column->{link}, 'text' => $column->{text}, 'show_sort_indicator' => $name eq $opts->{sort_indicator_column}, @@ -370,9 +375,6 @@ sub prepare_html_content { my $allow_pdf_export = $opts->{allow_pdf_export}; - eval { require PDF::API2; require PDF::Table; }; - $allow_pdf_export |= 1 if (! $@); - my $variables = { 'TITLE' => $opts->{title}, 'TOP_INFO_TEXT' => $self->html_format($opts->{top_info_text}), @@ -440,7 +442,7 @@ sub generate_pdf_content { my $font_encoding = $main::dbcharset || 'ISO-8859-15'; $self->{text_is_utf8} = $font_encoding =~ m/^utf-?8$/i; - foreach $name (@visible_columns) { + foreach my $name (@visible_columns) { push @column_props, { 'justify' => $self->{columns}->{$name}->{align} eq 'right' ? 'right' : 'left' }; } @@ -450,8 +452,8 @@ sub generate_pdf_content { push @data, $data_row; push @cell_props, $cell_props_row; - foreach $name (@visible_columns) { - $column = $self->{columns}->{$name}; + foreach my $name (@visible_columns) { + my $column = $self->{columns}->{$name}; push @{ $data_row }, $self->_decode_text($column->{text}); push @{ $cell_props_row }, {}; @@ -621,6 +623,7 @@ sub generate_pdf_content { 'column_props' => \@column_props, 'cell_props' => \@cell_props, 'max_word_length' => 60, + 'border' => 0.5, ); foreach my $page_num (1..$pdf->pages()) { @@ -886,20 +889,12 @@ The html generation function. Is invoked by generate_with_headers. =item generate_pdf_content -The PDF generation function. It is invoked by generate_with_headers, tests whether or not the Perl module PDF::API2 is installed and calls render_pdf_with_pdf_api2 if it is and render_pdf_with_html2ps otherwise. +The PDF generation function. It is invoked by generate_with_headers and renders the PDF with the PDF::API2 library. =item generate_csv_content The CSV generation function. Uses XS_CSV to parse the information into csv. -=item render_pdf_with_pdf_api2 - -PDF render function using the Perl module PDF::API2. - -=item render_pdf_with_html2ps - -PDF render function using the external application html2ps. - =back =head1 CONFIGURATION @@ -920,7 +915,7 @@ Output format. Used by generate_with_headers to determine the format. Supported =item allow_pdf_export -Used to determine if a button for PDF export should be displayed. Default is yes. The PDF button is hidden if neither the Perl module PDF::API2 nor the external applications html2ps and Ghostscript are available regardless of this parameter's value. +Used to determine if a button for PDF export should be displayed. Default is yes. =item allow_csv_export