From: Sven Schöling Date: Wed, 18 Sep 2013 13:09:31 +0000 (+0200) Subject: paginating im druck gefixt. debugmeldungen aufgeräumt X-Git-Tag: release-3.1.0beta1~46 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=95f9f85a003a94c70a8daaaef7aef91522050fa6;p=kivitendo-erp.git paginating im druck gefixt. debugmeldungen aufgeräumt --- diff --git a/SL/Controller/DeliveryPlan.pm b/SL/Controller/DeliveryPlan.pm index f5d5b4e34..348b55341 100644 --- a/SL/Controller/DeliveryPlan.pm +++ b/SL/Controller/DeliveryPlan.pm @@ -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 { diff --git a/SL/Controller/Helper/GetModels.pm b/SL/Controller/Helper/GetModels.pm index 7696fc1ea..a4cd973b8 100644 --- a/SL/Controller/Helper/GetModels.pm +++ b/SL/Controller/Helper/GetModels.pm @@ -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); } diff --git a/SL/Controller/Helper/GetModels/Paginated.pm b/SL/Controller/Helper/GetModels/Paginated.pm index a632fc0a1..871f4b5c1 100644 --- a/SL/Controller/Helper/GetModels/Paginated.pm +++ b/SL/Controller/Helper/GetModels/Paginated.pm @@ -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; } diff --git a/SL/Controller/Helper/GetModels/Sorted.pm b/SL/Controller/Helper/GetModels/Sorted.pm index defa67507..dee86810f 100644 --- a/SL/Controller/Helper/GetModels/Sorted.pm +++ b/SL/Controller/Helper/GetModels/Sorted.pm @@ -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) ] }