]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/ReportGenerator.pm
Wenn das "Pfeil"-Bild Teil eines Links ist, dann keinen Rahmen daraum zeichnen.
[kivitendo-erp.git] / SL / ReportGenerator.pm
index 37e6bede01b0d60dfa6a728a747cb0ca34345679..306236fb22a78f7934ea8932ab60802b158cf2d8 100644 (file)
@@ -86,17 +86,30 @@ sub set_sort_indicator {
 sub add_data {
   my $self = shift;
 
+  my $last_row_set;
+
   while (my $arg = shift) {
     if ('ARRAY' eq ref $arg) {
       push @{ $self->{data} }, $arg;
+      $last_row_set = $arg;
 
     } elsif ('HASH' eq ref $arg) {
-      push @{ $self->{data} }, [ $arg ];
+      my $row_set = [ $arg ];
+      push @{ $self->{data} }, $row_set;
+      $last_row_set = $row_set;
 
     } else {
       $self->{form}->error('Incorrect usage -- expecting hash or array ref');
     }
   }
+
+  return $last_row_set;
+}
+
+sub add_separator {
+  my $self = shift;
+
+  push @{ $self->{data} }, { 'type' => 'separator' };
 }
 
 sub clear_data {
@@ -239,6 +252,18 @@ sub prepare_html_content {
   my @rows;
 
   foreach my $row_set (@{ $self->{data} }) {
+    if ('HASH' eq ref $row_set) {
+      my $row_data = {
+        'IS_CONTROL'    => 1,
+        'IS_SEPARATOR'  => $row_set->{type} eq 'separator',
+        'NUM_COLUMNS'   => scalar @visible_columns,
+      };
+
+      push @rows, $row_data;
+
+      next;
+    }
+
     $outer_idx++;
 
     foreach my $row (@{ $row_set }) {
@@ -360,8 +385,11 @@ END
   $html_file->print($form->parse_html_template('report_generator/pdf_report', $variables));
   $html_file->close();
 
-  my $gs = IO::File->new("\"${main::html2ps_bin}\" -f \"${cfg_file_name}\" \"${html_file_name}\" | " .
-                         "\"${main::ghostscript_bin}\" -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=${opt_paper_size} -sOutputFile=- -c .setpdfwrite - |");
+  my $cmdline =
+    "\"${main::html2ps_bin}\" -f \"${cfg_file_name}\" \"${html_file_name}\" | " .
+    "\"${main::ghostscript_bin}\" -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=${opt_paper_size} -sOutputFile=- -c .setpdfwrite -";
+
+  my $gs = IO::File->new("${cmdline} |");
   if ($gs) {
     while (my $line = <$gs>) {
       print $line;
@@ -404,6 +432,7 @@ sub generate_csv_content {
   }
 
   foreach my $row_set (@{ $self->{data} }) {
+    next if ('ARRAY' ne ref $row_set);
     foreach my $row (@{ $row_set }) {
       $csv->print($stdout, [ map { $row->{$_}->{data} } @visible_columns ]);
     }