Druck: Bei template-toolkit auch die globals setzen
[kivitendo-erp.git] / SL / ReportGenerator.pm
index deb4e19..6fc50e9 100644 (file)
@@ -121,7 +121,7 @@ sub add_data {
         $row->{$column}->{align}   = $self->{columns}->{$column}->{align} unless (defined $row->{$column}->{align});
       }
 
-      foreach my $field (qw(data link)) {
+      foreach my $field (qw(data link link_class)) {
         map { $row->{$_}->{$field} = [ $row->{$_}->{$field} ] if (ref $row->{$_}->{$field} ne 'ARRAY') } keys %{ $row };
       }
     }
@@ -349,8 +349,9 @@ sub prepare_html_content {
         $col->{CELL_ROWS} = [ ];
         foreach my $i (0 .. scalar(@{ $col->{data} }) - 1) {
           push @{ $col->{CELL_ROWS} }, {
-            'data' => $self->html_format($col->{data}->[$i]),
+            'data' => '' . $self->html_format($col->{data}->[$i]),
             'link' => $col->{link}->[$i],
+            link_class => $col->{link_class}->[$i],
           };
         }
 
@@ -401,6 +402,7 @@ sub prepare_html_content {
     'EXPORT_NEXTSUB'       => $self->{export}->{nextsub},
     'DATA_PRESENT'         => $self->{data_present},
     'CONTROLLER_DISPATCH'  => $opts->{controller_class},
+    'TABLE_CLASS'          => $opts->{table_class},
   };
 
   return $variables;
@@ -441,7 +443,7 @@ sub generate_pdf_content {
   my $num_columns     = scalar @visible_columns;
   my $num_header_rows = 1;
 
-  my $font_encoding   = $::lx_office_conf{system}->{dbcharset} || 'ISO-8859-15';
+  my $font_encoding   = 'UTF-8';
 
   foreach my $name (@visible_columns) {
     push @column_props, { 'justify' => $self->{columns}->{$name}->{align} eq 'right' ? 'right' : 'left' };
@@ -703,7 +705,7 @@ sub _handle_quoting_and_encoding {
   my ($self, $text, $do_unquote) = @_;
 
   $text = $main::locale->unquote_special_chars('HTML', $text) if $do_unquote;
-  $text = Encode::encode('UTF-8', $text) if $::locale->is_utf8;
+  $text = Encode::encode('UTF-8', $text);
 
   return $text;
 }
@@ -791,7 +793,7 @@ __END__
 
 =head1 NAME
 
-SL::ReportGenerator.pm: the Lx-Office way of getting data in shape
+SL::ReportGenerator.pm: the kivitendo way of getting data in shape
 
 =head1 SYNOPSIS
 
@@ -815,7 +817,7 @@ Then there are some options made by the user, such as hidden columns. You add mo
 Then it lacks usability. You want it to be able to sort the data. You add code for that.
 Then there are too many results, you need pagination, you want to print or export that data..... and so on.
 
-The ReportGenerator class was designed because this exact scenario happened about half a dozen times in Lx-Office.
+The ReportGenerator class was designed because this exact scenario happened about half a dozen times in kivitendo.
 It's purpose is to manage all those formating, culling, sorting, and templating.
 Which makes it almost as complicated to use as doing the work for yourself.