From: Moritz Bunkus Date: Thu, 13 Dec 2007 14:20:30 +0000 (+0000) Subject: Unterstützung für strukturierte Variablennamen und Hash- und Arraystrukturen in ... X-Git-Tag: release-2.6.0beta1~388 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=baba1fe94140984bd580ad34df31e8524c822c99;p=kivitendo-erp.git Unterstützung für strukturierte Variablennamen und Hash- und Arraystrukturen in $form in den mitzuschleifenden Variablen. --- diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index 29e2d9480..e00b93f3d 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -44,7 +44,7 @@ sub new { }; $self->{export} = { 'nextsub' => '', - 'variable_list' => '', + 'variable_list' => [], }; $self->{data_present} = 0; @@ -209,7 +209,7 @@ sub set_export_options { $self->{export} = { 'nextsub' => shift, - 'variable_list' => join(" ", @_), + 'variable_list' => [ @_ ], }; } @@ -362,10 +362,7 @@ sub prepare_html_content { } } - my @export_variables; - foreach my $key (split m/ +/, $self->{export}->{variable_list}) { - push @export_variables, { 'key' => $key, 'value' => $self->{form}->{$key} }; - } + my @export_variables = $self->{form}->flatten_variables(@{ $self->{export}->{variable_list} }); my $allow_pdf_export = $opts->{allow_pdf_export} && (-x $main::html2ps_bin) && (-x $main::ghostscript_bin); @@ -382,7 +379,7 @@ sub prepare_html_content { 'NUM_COLUMNS' => scalar @column_headers, 'ROWS' => \@rows, 'EXPORT_VARIABLES' => \@export_variables, - 'EXPORT_VARIABLE_LIST' => $self->{export}->{variable_list}, + 'EXPORT_VARIABLE_LIST' => join(' ', @{ $self->{export}->{variable_list} }), 'EXPORT_NEXTSUB' => $self->{export}->{nextsub}, 'DATA_PRESENT' => $self->{data_present}, }; diff --git a/bin/mozilla/reportgenerator.pl b/bin/mozilla/reportgenerator.pl index bdccb3b5a..38ee57876 100644 --- a/bin/mozilla/reportgenerator.pl +++ b/bin/mozilla/reportgenerator.pl @@ -34,8 +34,7 @@ sub report_generator_export_as_pdf { return; } - my @form_values; - map { push @form_values, { 'key' => $_, 'value' => $form->{$_} } } keys %{ $form }; + my @form_values = $form->flatten_variables(keys %{ $form }); $form->get_lists('printers' => 'ALL_PRINTERS'); map { $_->{selected} = $myconfig{default_printer_id} == $_->{id} } @{ $form->{ALL_PRINTERS} }; @@ -58,8 +57,7 @@ sub report_generator_export_as_csv { return; } - my @form_values; - map { push @form_values, { 'key' => $_, 'value' => $form->{$_} } } keys %{ $form }; + my @form_values = $form->flatten_variables(keys %{ $form }); $form->{title} = $locale->text('CSV export -- options'); $form->header();