From 7a3d38760ad199966eeb38d32fdf3afe800dd1de Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 13 Apr 2015 11:23:20 -0400 Subject: [PATCH] Bug 13986 - Printing a list only prints the results of the page you are viewing The print list button only prints the page you are viewing, and not the entire list. Test Plan: 1) Apply this patch 2) Create a list with enough items that it will paginate 3) Browse to that list, click the 'print list' button 4) Note the entire list prints, not just the visible items --- C4/VirtualShelves/Page.pm | 30 +++++++++++++------ koha-tmpl/intranet-tmpl/prog/en/css/print.css | 2 +- .../prog/en/includes/virtualshelves-toolbar.inc | 6 +--- .../prog/en/modules/virtualshelves/shelves.tt | 14 ++++++++- virtualshelves/shelves.pl | 1 + 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 8620d7d..a059e49 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -76,11 +76,17 @@ sub shelfpage { my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset ); my $marcflavour = C4::Context->preference("marcflavour"); - $shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') ); - $shelflimit = $shelflimit || ShelvesMax('MGRPAGE'); - $shelfoffset = ( $itemoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving items at - $shelveslimit = $shelflimit; # Limits number of shelves returned for a given query (row_count) - $shelvesoffset = ( $shelfoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving shelves at (offset) + unless ( $query->param('print') ) { + $shelflimit = + ( $type eq 'opac' + ? C4::Context->preference('OPACnumSearchResults') + : C4::Context->preference('numSearchResults') ); + $shelflimit = $shelflimit || ShelvesMax('MGRPAGE'); + $shelfoffset = ( $itemoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving items at + $shelveslimit = $shelflimit; # Limits number of shelves returned for a given query (row_count) + $shelvesoffset = ( $shelfoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving shelves at (offset) + } + # getting the Shelves list my $category = ( ( $displaymode eq 'privateshelves' ) ? 1 : 2 ); my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ); @@ -459,12 +465,16 @@ sub shelfpage { $qhash{$_} = $query->param($_) if $query->param($_); } ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash; - if ( $shelfnumber && $totitems ) { - $template->param( pagination_bar => pagination_bar( $url, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), $itemoff, "itemoff" ) ); - } elsif ( $totshelves ) { - $template->param( - pagination_bar => pagination_bar( $url, ( int( $totshelves / $shelveslimit ) ) + ( ( $totshelves % $shelveslimit ) > 0 ? 1 : 0 ), $shelfoff, "shelfoff" ) ); + + unless ( $query->param('print')) { + if ( $shelfnumber && $totitems ) { + $template->param( pagination_bar => pagination_bar( $url, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), $itemoff, "itemoff" ) ); + } elsif ( $totshelves ) { + $template->param( + pagination_bar => pagination_bar( $url, ( int( $totshelves / $shelveslimit ) ) + ( ( $totshelves % $shelveslimit ) > 0 ? 1 : 0 ), $shelfoff, "shelfoff" ) ); + } } + $template->param( shelveslooppriv => \@shelveslooppriv, shelvesloop => \@shelvesloop, diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/print.css b/koha-tmpl/intranet-tmpl/prog/en/css/print.css index 239059c..e0e346e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/print.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/print.css @@ -322,4 +322,4 @@ fieldset { } #cataloguing_additem_itemlist { overflow : visible !important; -} \ No newline at end of file +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc index 4de9e19..1e00cc4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc @@ -12,10 +12,6 @@ sendList(); return false; }); - $("#printlist").click(function(){ - print(); - return false; - }); $("#deleteshelf").click(function(e){ if(confirmDelete(_("Are you sure you want to delete this list?"))){ return true; @@ -60,6 +56,6 @@
Send list
-
Print list
+
Print list
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index bba00b3..3648ebf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -1,6 +1,16 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › [% IF ( viewshelf ) %]Lists › Contents of [% shelfname | html %][% ELSE %]Lists[% END %][% IF ( shelves ) %] › Create new list[% END %][% IF ( edit ) %] › Edit list [% shelfname | html %][% END %] [% INCLUDE 'doc-head-close.inc' %] + +[% IF print %] + +[% END %] + [% IF ( viewshelf ) %] @@ -282,7 +292,7 @@ function placeHold () { [% SET new_direction = 'asc' %] [% END %] -
+
[% IF ( itemsloop ) %]
| @@ -402,7 +412,7 @@ function placeHold () { [% IF ( allowaddingitem ) %]
-
+
Add an item to [% shelfname | html %]
  1. diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 9dba3f4..858d1a4 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -35,4 +35,5 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( flagsrequired => { catalogue => 1 }, } ); +$template->param( print => $query->param('print') ); shelfpage('intranet', $query, $template, $loggedinuser, $cookie); -- 1.7.2.5