Bugzilla – Attachment 69364 Details for
Bug 19369
Add a helper function for translating pagination params into SQL::Abstract
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19369: Add helper function for pagination attributes generation
Bug-19369-Add-helper-function-for-pagination-attri.patch (text/plain), 1.80 KB, created by
Kyle M Hall (khall)
on 2017-11-27 11:35:56 UTC
(
hide
)
Description:
Bug 19369: Add helper function for pagination attributes generation
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-11-27 11:35:56 UTC
Size:
1.80 KB
patch
obsolete
>From 6ce44660fa589abea3838ef35c92f28715b241c0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 26 Sep 2017 15:12:19 -0300 >Subject: [PATCH] Bug 19369: Add helper function for pagination attributes > generation > >This patch introduces a new helper function to the Koha::REST::Plugin::Pagination >plugin, called 'dbic_merge_pagination'. > >This simple function adds SQL::Abstract pagination attributes ('page' and 'rows') to the >passed $filter hashref. > >To test: >- Apply this patches >- Run: > $ koha-shell kohadev > k$ cd kohaclone > k$ prove t/Koha/REST/Plugin/Pagination.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Sponsored-by: Camden County > >Signed-off-by: Lari Taskula <lari.taskula@jns.fi> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/REST/Plugin/Pagination.pm | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > >diff --git a/Koha/REST/Plugin/Pagination.pm b/Koha/REST/Plugin/Pagination.pm >index 5f5b7eb..55a9bf6 100644 >--- a/Koha/REST/Plugin/Pagination.pm >+++ b/Koha/REST/Plugin/Pagination.pm >@@ -107,6 +107,32 @@ It also adds X-Total-Count, containing the total results count. > return $c; > } > ); >+ >+=head3 dbic_merge_pagination >+ >+ $filter = $c->dbic_merge_pagination({ >+ filter => $filter, >+ params => { >+ page => $params->{_page}, >+ per_page => $params->{_per_page} >+ } >+ }); >+ >+Adds I<page> and I<rows> elements to the filter parameter. >+ >+=cut >+ >+ $app->helper( >+ 'dbic_merge_pagination' => sub { >+ my ( $c, $args ) = @_; >+ my $filter = $args->{filter}; >+ >+ $filter->{page} = $args->{params}->{_page}; >+ $filter->{rows} = $args->{params}->{_per_page}; >+ >+ return $filter; >+ } >+ ); > } > > =head2 Internal methods >-- >2.10.2
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 19369
:
67376
|
67378
|
67381
|
67382
|
67544
|
67545
|
69363
| 69364