From dba493ac8d5e53b863d59fa25d3b9d2de396b027 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 21 Jun 2007 14:14:49 +0000 Subject: [PATCH] ReportGenerator: Man kann jetzt die Standardanordnung (align) in den Spalten angegeben werden. --- SL/ReportGenerator.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index 281000602..cdcf18fab 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -107,7 +107,14 @@ sub add_data { $self->{form}->error('Incorrect usage -- expecting hash or array ref'); } + my @columns_with_default_alignment = grep { defined $self->{columns}->{$_}->{align} } keys %{ $self->{columns} }; + foreach my $row (@{ $row_set }) { + foreach my $column (@columns_with_default_alignment) { + $row->{$column} ||= { }; + $row->{$column}->{align} = $self->{columns}->{$column}->{align} unless (defined $row->{$column}->{align}); + } + foreach my $field (qw(data link)) { map { $row->{$_}->{$field} = [ $row->{$_}->{$field} ] if (ref $row->{$_}->{$field} ne 'ARRAY') } keys %{ $row }; } -- 2.20.1