From b439a305f0c01400cfbeaa1d9a08076b7564649b Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 2 Oct 2017 13:22:10 -0300 Subject: [PATCH] Bug 19369: (followup) Rename params for consitency with 19370 --- Koha/REST/Plugin/Pagination.pm | 17 +++++++++-------- t/Koha/REST/Plugin/Pagination.t | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Koha/REST/Plugin/Pagination.pm b/Koha/REST/Plugin/Pagination.pm index 55a9bf6c31..1afbfca09f 100644 --- a/Koha/REST/Plugin/Pagination.pm +++ b/Koha/REST/Plugin/Pagination.pm @@ -110,27 +110,28 @@ It also adds X-Total-Count, containing the total results count. =head3 dbic_merge_pagination - $filter = $c->dbic_merge_pagination({ - filter => $filter, + $attributes = $c->dbic_merge_pagination({ + attributes => $attributes, params => { page => $params->{_page}, - per_page => $params->{_per_page} + per_page => $params->{_per_page}, + ... } }); -Adds I and I elements to the filter parameter. +Adds I and I elements to the I parameter. =cut $app->helper( 'dbic_merge_pagination' => sub { my ( $c, $args ) = @_; - my $filter = $args->{filter}; + my $attributes = $args->{attributes}; - $filter->{page} = $args->{params}->{_page}; - $filter->{rows} = $args->{params}->{_per_page}; + $attributes->{page} = $args->{params}->{_page}; + $attributes->{rows} = $args->{params}->{_per_page}; - return $filter; + return $attributes; } ); } diff --git a/t/Koha/REST/Plugin/Pagination.t b/t/Koha/REST/Plugin/Pagination.t index 37cf0ca88d..698fd43a59 100644 --- a/t/Koha/REST/Plugin/Pagination.t +++ b/t/Koha/REST/Plugin/Pagination.t @@ -53,9 +53,9 @@ get '/pagination_headers_last_page' => sub { get '/dbic_merge_pagination' => sub { my $c = shift; - my $filter = { firstname => 'Kyle', surname => 'Hall' }; - $filter = $c->dbic_merge_pagination({ filter => $filter, params => { _page => 1, _per_page => 3 } }); - $c->render( json => $filter, status => 200 ); + my $attributes = { firstname => 'Kyle', surname => 'Hall' }; + $attributes = $c->dbic_merge_pagination({ attributes => $attributes, params => { _page => 1, _per_page => 3 } }); + $c->render( json => $attributes, status => 200 ); }; # The tests -- 2.14.2