Revision 078fa02a
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/ReportGenerator.pm | ||
---|---|---|
322 | 322 |
foreach my $row (@{ $row_set }) { |
323 | 323 |
$inner_idx++; |
324 | 324 |
|
325 |
my $output_columns = [ ]; |
|
326 |
my $skip_next = 0; |
|
325 | 327 |
foreach my $col_name (@visible_columns) { |
328 |
if ($skip_next) { |
|
329 |
$skip_next--; |
|
330 |
next; |
|
331 |
} |
|
332 |
|
|
326 | 333 |
my $col = $row->{$col_name}; |
327 | 334 |
$col->{CELL_ROWS} = [ ]; |
328 | 335 |
foreach my $i (0 .. scalar(@{ $col->{data} }) - 1) { |
... | ... | |
339 | 346 |
} elsif ((1 == scalar @{ $col->{CELL_ROWS} }) && (!defined $col->{CELL_ROWS}->[0]->{data} || ($col->{CELL_ROWS}->[0]->{data} eq ''))) { |
340 | 347 |
$col->{CELL_ROWS}->[0]->{data} = ' '; |
341 | 348 |
} |
349 |
|
|
350 |
push @{ $output_columns }, $col; |
|
351 |
$skip_next = $col->{colspan} ? $col->{colspan} - 1 : 0; |
|
342 | 352 |
} |
343 | 353 |
|
344 | 354 |
my $row_data = { |
345 |
'COLUMNS' => [ map { $row->{$_} } @visible_columns ],
|
|
355 |
'COLUMNS' => $output_columns,
|
|
346 | 356 |
'outer_idx' => $outer_idx, |
347 | 357 |
'outer_idx_odd' => $outer_idx % 2, |
348 | 358 |
'inner_idx' => $inner_idx, |
... | ... | |
696 | 706 |
$csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}) } @visible_columns ]); |
697 | 707 |
|
698 | 708 |
} else { |
699 |
foreach my $custom_header_row (@{ $self->{custom_headers} }) { |
|
700 |
$csv->print($stdout, [ map { $self->unescape_string($_->{text}) } @{ $custom_header_row } ]); |
|
709 |
foreach my $row (@{ $self->{custom_headers} }) { |
|
710 |
my $fields = [ ]; |
|
711 |
my $skip_next = 0; |
|
712 |
|
|
713 |
foreach my $col (@{ $row }) { |
|
714 |
my $num_output = ($col->{colspan} && ($col->{colspan} > 1)) ? $col->{colspan} : 1; |
|
715 |
push @{ $fields }, ($self->unescape_string($col->{text})) x $num_output; |
|
716 |
} |
|
717 |
|
|
718 |
$csv->print($stdout, $fields); |
|
701 | 719 |
} |
702 | 720 |
} |
703 | 721 |
} |
... | ... | |
706 | 724 |
next if ('ARRAY' ne ref $row_set); |
707 | 725 |
foreach my $row (@{ $row_set }) { |
708 | 726 |
my @data; |
727 |
my $skip_next = 0; |
|
709 | 728 |
foreach my $col (@visible_columns) { |
729 |
if ($skip_next) { |
|
730 |
$skip_next--; |
|
731 |
next; |
|
732 |
} |
|
733 |
|
|
734 |
my $num_output = ($col->{colspan} && ($col->{colspan} > 1)) ? $col->{colspan} : 1; |
|
735 |
$skip_next = $num_output - 1; |
|
736 |
|
|
710 | 737 |
push @data, join($eol, map { s/\r?\n/$eol/g; $_ } @{ $row->{$col}->{data} }); |
738 |
push @data, ('') x $skip_next if ($skip_next); |
|
711 | 739 |
} |
740 |
|
|
712 | 741 |
$csv->print($stdout, \@data); |
713 | 742 |
} |
714 | 743 |
} |
Auch abrufbar als: Unified diff
ReportGenerator: Unterstützung für das Verbinden von Zellen mittels "colspan" für HTML- und CSV-Ausgabe.