From 3a7d5afb5ad6b73ae8884a8e24b05ce25afda9f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 29 May 2013 15:04:53 +0200 Subject: [PATCH] Fix: GetModels mit Paginated ohne Filtered MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die Erkennung ob die Argumente aus Filtered übernommenw erden sollen war ein wenig optimistisch. --- SL/Controller/Helper/Paginated.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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); -- 2.20.1