Bugzilla – Attachment 65020 Details for
Bug 18937
Limit the number of entries to print for larger lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18937: Limit the number of list entries to print
Bug-18937-Limit-the-number-of-list-entries-to-prin.patch (text/plain), 3.64 KB, created by
Marcel de Rooy
on 2017-07-13 12:41:17 UTC
(
hide
)
Description:
Bug 18937: Limit the number of list entries to print
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-07-13 12:41:17 UTC
Size:
3.64 KB
patch
obsolete
>From faa0046290df362bd1e21957b9c91f191389e93d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 13 Jul 2017 14:26:21 +0200 >Subject: [PATCH] Bug 18937: Limit the number of list entries to print >Content-Type: text/plain; charset=utf-8 > >When you have large lists of say 2000 entries, the option Print a list may >be very time consuming. Especially when an impatient user hits refresh a >couple of times, this might affect your server performance. > >This patch adds paging to list printing when the number of list entries is >over 200 (just a constant). The number of entries to print is now governed >by preference OPACnumSearchResults. > >Test plan: >[1] Pick a small list. Verify that print (add print=1 to URL) includes all > records. >[2] Pick a large list (>200 entries). Verify that print now only includes > records of the current page. >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 2 +- > opac/opac-shelves.pl | 9 +++++++-- > 2 files changed, 8 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 2c162c0..195333c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -155,7 +155,7 @@ > <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span> > [% END %] > >- <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1">Print list</a> >+ <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1&page=[% page %]">Print list</a> > > [% IF can_manage_shelf %] > <span class="sep">|</span> >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index e790b43..d19622e 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -38,6 +38,8 @@ use Koha::RecordProcessor; > > use constant ANYONE => 2; > >+use constant MAX_PRINT_ENTRIES => 200; >+ > my $query = new CGI; > > my $template_name = $query->param('rss') ? "opac-shelves-rss.tt" : "opac-shelves.tt"; >@@ -237,10 +239,13 @@ if ( $op eq 'view' ) { > my $direction = $query->param('direction') || 'asc'; > $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; > my ( $page, $rows ); >- unless ( $query->param('print') or $query->param('rss') ) { >+ if ( ( $query->param('print') >+ && $shelf->get_contents->count > MAX_PRINT_ENTRIES ) >+ || ( !$query->param('rss') && !$query->param('print') ) ) { > $rows = C4::Context->preference('OPACnumSearchResults') || 20; >- $page = ( $query->param('page') ? $query->param('page') : 1 ); >+ $page = $query->param('page') || 1; > } >+ $template->param( page => $page ); > my $order_by = $sortfield eq 'itemcallnumber' ? 'items.itemcallnumber' : $sortfield; > my $contents = $shelf->get_contents->search( > {}, >-- >2.1.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 18937
: 65020 |
65533