#use PDF::Table;
use strict;
+use SL::Helper::GlAttachments qw(append_gl_pdf_attachments);
+use SL::Helper::CreatePDF qw(merge_pdfs);
# Cause locales.pl to parse these files:
# parse_html_template('report_generator/html_report')
'escape_char' => '"',
'eol_style' => 'Unix',
'headers' => 1,
+ 'encoding' => 'UTF-8',
},
};
$self->{export} = {
'align' => $column->{align},
'link' => $column->{link},
'text' => $column->{text},
+ 'raw_header_data' => $column->{raw_header_data},
'show_sort_indicator' => $name eq $opts->{sort_indicator_column},
'sort_indicator_direction' => $opts->{sort_indicator_direction},
};
foreach (0 .. $num_columns - 1) {
push @{ $cell_props_row }, { 'background_color' => '#666666',
- 'font_color' => '#ffffff',
+ # BUG PDF:Table -> 0.9.12:
+ # font_color is used in next row, so dont set font_color
+ # 'font_color' => '#ffffff',
'colspan' => $_ == 0 ? -1 : undef, };
}
}
my $content = $pdf->stringify();
+ $main::lxdebug->message(LXDebug->DEBUG2(),"addattachments ?? =".$form->{report_generator_addattachments}." GL=".$form->{GL});
+ if ( $form->{report_generator_addattachments} eq 'yes' && $form->{GL}) {
+ $content = $self->append_gl_pdf_attachments($form,$content);
+ }
+
my $printer_command;
if ($pdfopts->{print} && $pdfopts->{printer_id}) {
$form->{printer_id} = $pdfopts->{printer_id};
}
sub _handle_quoting_and_encoding {
- my ($self, $text, $do_unquote) = @_;
+ my ($self, $text, $do_unquote, $encoding) = @_;
$text = $main::locale->unquote_special_chars('HTML', $text) if $do_unquote;
- $text = Encode::encode('UTF-8', $text);
+ $text = Encode::encode($encoding || 'UTF-8', $text);
return $text;
}
if ($opts->{headers}) {
if (!$self->{custom_headers}) {
- $csv->print($stdout, [ map { $self->_handle_quoting_and_encoding($self->{columns}->{$_}->{text}, 1) } @visible_columns ]);
+ $csv->print($stdout, [ map { $self->_handle_quoting_and_encoding($self->{columns}->{$_}->{text}, 1, $opts->{encoding}) } @visible_columns ]);
} else {
foreach my $row (@{ $self->{custom_headers} }) {
foreach my $col (@{ $row }) {
my $num_output = ($col->{colspan} && ($col->{colspan} > 1)) ? $col->{colspan} : 1;
- push @{ $fields }, ($self->_handle_quoting_and_encoding($col->{text}, 1)) x $num_output;
+ push @{ $fields }, ($self->_handle_quoting_and_encoding($col->{text}, 1, $opts->{encoding})) x $num_output;
}
$csv->print($stdout, $fields);
my $num_output = ($row->{$col}{colspan} && ($row->{$col}->{colspan} > 1)) ? $row->{$col}->{colspan} : 1;
$skip_next = $num_output - 1;
- push @data, join($eol, map { s/\r?\n/$eol/g; $self->_handle_quoting_and_encoding($_, 0) } @{ $row->{$col}->{data} });
+ push @data, join($eol, map { s/\r?\n/$eol/g; $self->_handle_quoting_and_encoding($_, 0, $opts->{encoding}) } @{ $row->{$col}->{data} });
push @data, ('') x $skip_next if ($skip_next);
}
data, every array_ref as a collection of lines. Every line will be expected to
be in a key => value format. Note that the rows have to already have been
sorted.
-The ReportGenerator is only able to sort pre-sorted data by column direction
-(ascending or descending), and provides links to sorting and a visual cue as to
-which column was sorted by.
+
+The ReportGenerator is only able to display pre-sorted data and to indicate by
+which column and in which direction the data has been sorted via visual clues
+in the column headers. It also provides links to invert the sort direction.
=item add_separator
Include headers? Default is yes.
+=item encoding
+
+Character encoding. Default is UTF-8.
+
=back
=head1 SEE ALO