S:C:H:ReportGenerator: Ergebnis von layout->get als Liste verwenden
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 1 Aug 2017 12:36:04 +0000 (14:36 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 1 Aug 2017 12:39:10 +0000 (14:39 +0200)
Sonst ist der Export (PDF/CSV) von Controllern, die diesen Helper verwenden,
kaputt. Fehlermeldung war:
Can't locate object method "add" via package "1" (perhaps you forgot to load "1"?)
at SL/Controller/Helper/ReportGenerator.pm line 25.

SL/Controller/Helper/ReportGenerator.pm

index 5a83be4..41f0c6c 100644 (file)
@@ -22,16 +22,18 @@ sub _setup_action_bar {
   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 {