Bugzilla – Attachment 67606 Details for
Bug 19278
Add a configurable default page size for endpoints
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19278: Make the pagination plugin use RESTdefaultPageSize
Bug-19278-Make-the-pagination-plugin-use-RESTdefau.patch (text/plain), 1.67 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-10-04 13:46:57 UTC
(
hide
)
Description:
Bug 19278: Make the pagination plugin use RESTdefaultPageSize
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-10-04 13:46:57 UTC
Size:
1.67 KB
patch
obsolete
>From 5738e6355eb550a18c5b8e89381bdc349084948c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 8 Sep 2017 12:20:20 -0300 >Subject: [PATCH] Bug 19278: Make the pagination plugin use RESTdefaultPageSize > >This bug introduces a new syspref RESTdefaultPageSize that is used on >the Koha::REST::Plugin::Pagination plugin to default to a valid value >for the page size if the param is not present on the query. > >This patch also considers the situation in which no 'page' param is >passed, and no header should be added. > >To test: >- Run: > $ sudo koha-shell kohadev > k$ cd kohaclone > k$ prove t/Koha/REST/Plugin/Pagination.t >=> FAIL: Tests fail because the plugin doesn't behave as the tests >expect. >- Apply this patch >- Run: > k$ prove t/Koha/REST/Plugin/Pagination.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Sponsored-by: Camden County >Sponsored-by: ByWater Solutions >--- > Koha/REST/Plugin/Pagination.pm | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/Plugin/Pagination.pm b/Koha/REST/Plugin/Pagination.pm >index 1afbfca..f64e932 100644 >--- a/Koha/REST/Plugin/Pagination.pm >+++ b/Koha/REST/Plugin/Pagination.pm >@@ -60,7 +60,11 @@ It also adds X-Total-Count, containing the total results count. > > my $total = $args->{total}; > my $req_page = $args->{params}->{_page}; >- my $per_page = $args->{params}->{_per_page}; >+ my $per_page = $args->{params}->{_per_page} // >+ C4::Context->preference('RESTdefaultPageSize'); >+ >+ # do we need to paginate? >+ return $c unless $req_page; > > my $pages = int $total / $per_page; > $pages++ >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19278
:
66994
|
66995
|
66996
|
67341
|
67604
|
67605
|
67606
|
67607
|
67700
|
67701
|
67702
|
67703
|
67790
|
67791
|
67792
|
67793
|
69365
|
69366
|
69367
|
69368
|
69704