paginating im druck gefixt. debugmeldungen aufgeräumt
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 18 Sep 2013 13:09:31 +0000 (15:09 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 14 Oct 2013 09:56:12 +0000 (11:56 +0200)
SL/Controller/DeliveryPlan.pm
SL/Controller/Helper/GetModels.pm
SL/Controller/Helper/GetModels/Paginated.pm
SL/Controller/Helper/GetModels/Sorted.pm

index f5d5b4e..348b553 100644 (file)
@@ -138,15 +138,11 @@ sub prepare_report {
 
   $column_defs{$_}->{text} = $sort_columns{$_} for keys %column_defs;
 
-  $self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
-  $self->models->finalize; # for filter laundering
   $report->set_options(
     std_column_visibility => 1,
     controller_class      => 'DeliveryPlan',
     output_format         => 'HTML',
     top_info_text         => $::locale->text('Delivery Plan for currently outstanding sales orders'),
-    raw_top_info_text     => $self->render('delivery_plan/report_top',    { output => 0 }),
-    raw_bottom_info_text  => $self->render('delivery_plan/report_bottom', { output => 0 }, models => $self->models),
     title                 => $::locale->text('Delivery Plan'),
     allow_pdf_export      => 1,
     allow_csv_export      => 1,
@@ -155,7 +151,13 @@ sub prepare_report {
   $report->set_column_order(@columns);
   $report->set_export_options(qw(list filter));
   $report->set_options_from_form;
+  $self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
+  $self->models->finalize; # for filter laundering
   $self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
+  $report->set_options(
+    raw_top_info_text     => $self->render('delivery_plan/report_top',    { output => 0 }),
+    raw_bottom_info_text  => $self->render('delivery_plan/report_bottom', { output => 0 }, models => $self->models),
+  );
 }
 
 sub make_filter_summary {
index 7696fc1..a4cd973 100644 (file)
@@ -31,6 +31,7 @@ sub disable_plugin {
   my ($self, $plugin) = @_;
   die 'cannot change internal state after finalize was called' if $self->finalized;
   die 'unsupported plugin' unless $self->can($plugin) && $self->$plugin && $self->$plugin->isa('SL::Controller::Helper::GetModels::Base');
+
   $self->$plugin->disabled(1);
 }
 
index a632fc0..871f4b5 100644 (file)
@@ -50,23 +50,26 @@ sub read_params {
 
 sub finalize {
   my ($self, %args)   = @_;
-#  return () unless $self->is_enabled;
-  my %paginate_params = $self->read_params;
 
-  # try to use Filtered if available and nothing else is configured, but don't
-  # blow up if the controller does not use Filtered
-  my %paginate_args     = ref($self->paginate_args) eq 'CODE'       ? %{ $self->paginate_args->($self) }
-                        :     $self->paginate_args  eq '__FILTER__'
-                           && $self->get_models->filtered ? $self->get_models->filtered->read_params
-                        :     $self->paginate_args  ne '__FILTER__' ? do { my $sub = $self->paginate_args; %{ $self->get_models->controller->$sub() } }
-                        :                                               ();
+  if ($self->is_enabled) {
+    my %paginate_params = $self->read_params;
 
-  %args = $self->merge_args(\%args, \%paginate_args);
+    # try to use Filtered if available and nothing else is configured, but don't
+    # blow up if the controller does not use Filtered
+    my %paginate_args     = ref($self->paginate_args) eq 'CODE'       ? %{ $self->paginate_args->($self) }
+                          :     $self->paginate_args  eq '__FILTER__'
+                             && $self->get_models->filtered ? $self->get_models->filtered->read_params
+                          :     $self->paginate_args  ne '__FILTER__' ? do { my $sub = $self->paginate_args; %{ $self->get_models->controller->$sub() } }
+                          :                                               ();
 
-  my $calculated_params = $self->get_models->manager->paginate(%paginate_params, args => \%args);
+    %args = $self->merge_args(\%args, \%paginate_args);
+
+    my $calculated_params = $self->get_models->manager->paginate(%paginate_params, args => \%args);
+
+    $self->calculated_params($calculated_params);
+  }
 
   $self->paginated_args(\%args);
-  $self->calculated_params($calculated_params);
 
   return %args;
 }
index defa675..dee8681 100644 (file)
@@ -123,17 +123,6 @@ sub _callback_handler_for_sorted {
   return %params;
 }
 
-#sub _get_models_handler_for_sorted {
-#  my ($self, %params) = @_;
-#
-#
-#
-#  # $::lxdebug->dump(0, "GM handler for sorted; params nach modif:", \%params);
-#
-#  return %params;
-#}
-
-
 sub init_form_params {
   [ qw(sort_by sort_dir) ]
 }