Bugzilla – Attachment 67545 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.74 KB, created by
Lari Taskula
on 2017-10-03 10:45:43 UTC
(
hide
)
Description:
Bug 19369: Add helper function for pagination attributes generation
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-10-03 10:45:43 UTC
Size:
1.74 KB
patch
obsolete
>From 79fac14265a0e2e044fd7bfc995ef7dd1ac9178b 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> >--- > 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.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 19369
:
67376
|
67378
|
67381
|
67382
|
67544
|
67545
|
69363
|
69364