From: Sven Schöling Date: Wed, 29 May 2013 13:04:53 +0000 (+0200) Subject: Fix: GetModels mit Paginated ohne Filtered X-Git-Tag: release-3.1.0beta1~401^2~4 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3a7d5afb5ad6b73ae8884a8e24b05ce25afda9f4;p=kivitendo-erp.git Fix: GetModels mit Paginated ohne Filtered Die Erkennung ob die Argumente aus Filtered übernommenw erden sollen war ein wenig optimistisch. --- diff --git a/SL/Controller/Helper/Paginated.pm b/SL/Controller/Helper/Paginated.pm index 8d572ecbd..25c4efa09 100644 --- a/SL/Controller/Helper/Paginated.pm +++ b/SL/Controller/Helper/Paginated.pm @@ -58,10 +58,13 @@ sub get_current_paginate_params { per_page => ($params{per_page} * 1) || $spec->{PER_PAGE}, ); - my %paginate_args = ref($spec->{PAGINATE_ARGS}) eq 'CODE' ? %{ $spec->{PAGINATE_ARGS}->($self) } - : $spec->{PAGINATE_ARGS} eq '__FILTER__' ? $self->get_current_filter_params - : $spec->{PAGINATE_ARGS} ? do { my $sub = $spec->{PAGINATE_ARGS}; %{ $self->$sub() } } - : (); + # 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($spec->{PAGINATE_ARGS}) eq 'CODE' ? %{ $spec->{PAGINATE_ARGS}->($self) } + : $spec->{PAGINATE_ARGS} eq '__FILTER__' + && $self->can('get_current_filter_params') ? $self->get_current_filter_params + : $spec->{PAGINATE_ARGS} ne '__FILTER__' ? do { my $sub = $spec->{PAGINATE_ARGS}; %{ $self->$sub() } } + : (); my $calculated_params = "SL::DB::Manager::$spec->{MODEL}"->paginate(%paginate_params, args => \%paginate_args); # $::lxdebug->dump(0, "get_current_paginate_params: ", $calculated_params);