my $key = $::form->{CONTROLLER_DISPATCH} ? 'action' : 'report_generator_form.report_generator_dispatch_to';
my $value = $::form->{CONTROLLER_DISPATCH} ? $::form->{CONTROLLER_DISPATCH} . "/" : '';
- $::request->layout->get('actionbar')->add(
- action => [
- $type eq 'pdf' ? $::locale->text('PDF export') : $::locale->text('CSV export'),
- submit => [ '#report_generator_form', { $key => "${value}report_generator_export_as_${type}" } ],
- ],
- action => [
- $::locale->text('Back'),
- submit => [ '#report_generator_form', { $key => "${value}report_generator_back" } ],
- ],
- );
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ $type eq 'pdf' ? $::locale->text('PDF export') : $::locale->text('CSV export'),
+ submit => [ '#report_generator_form', { $key => "${value}report_generator_export_as_${type}" } ],
+ ],
+ action => [
+ $::locale->text('Back'),
+ submit => [ '#report_generator_form', { $key => "${value}report_generator_back" } ],
+ ],
+ );
+ }
}
sub action_report_generator_export_as_pdf {
for my $obj (@{ $params{objects} || [] }) {
my %data = map {
my $def = $column_defs->{$_};
- $_ => {
- raw_data => $def->{raw_data} ? $def->{raw_data}->($obj) : '',
- data => $def->{sub} ? $def->{sub}->($obj)
- : $obj->can($_) ? $obj->$_
- : $obj->{$_},
- link => $def->{obj_link} ? $def->{obj_link}->($obj) : '',
- },
+ my $tmp;
+ $tmp->{raw_data} = $def->{raw_data} ? $def->{raw_data}->($obj) : '';
+ $tmp->{data} = $def->{sub} ? $def->{sub}->($obj)
+ : $obj->can($_) ? $obj->$_
+ : $obj->{$_};
+ $tmp->{link} = $def->{obj_link} ? $def->{obj_link}->($obj) : '';
+ $_ => $tmp;
} @columns;
$params{data_callback}->(\%data) if $params{data_callback};