[Koha-patches] [PATCH] Bug 2940 - private shelf (list) display error on 2nd and subsequent pages.

Joe Atzberger joe.atzberger at liblime.com
Mon Feb 2 21:36:19 CET 2009


The before/after URL for the 2nd page of list elements:
http://atz.dev.kohalibrary.com/cgi-bin/koha/opac-shelves.pl?display=privateshelves?viewshelf=120&itemoff=2
http://atz.dev.kohalibrary.com/cgi-bin/koha/opac-shelves.pl?viewshelf=120&display=privateshelves&itemoff=2

The change in query string arguments is incidental, the prevention of multiple "?" is essential.
---
 C4/VirtualShelves/Page.pm |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 8e45029..27db71e 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -291,9 +291,13 @@ foreach my $element (sort { lc($shelflist->{$a}->{'shelfname'}) cmp lc($shelflis
 		push (@shelvesloop, $shelflist->{$element});
 	}
 }
+
 my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl";
-$url .= "?display=" . $query->param('display') if $query->param('display');
-$url .= "?viewshelf=" . $query->param('viewshelf') if $query->param('viewshelf');
+my %qhash = ();
+foreach (qw(display viewshelf)) {
+    $qhash{$_} = $query->param($_) if $query->param($_);
+}
+(scalar keys %qhash) and $url .= '?' . join '&', map {"$_=$qhash{$_}"} keys %qhash;
 if ($query->param('viewshelf')) {
 	$template->param( {pagination_bar => pagination_bar($url, (int($totitems/$shelflimit)) + (($totitems % $shelflimit) > 0 ? 1 : 0), $itemoff, "itemoff")} );
 } else {
@@ -311,7 +315,7 @@ if ($template->param('viewshelf') or
 	$template->param(  'edit'   ) ) {
 	$template->param(vseflag => 1);
 }
-if ($template->param( 'shelves' ) or
+if ($template->param( 'shelves' ) or    # note: this part looks duplicative, but is intentional
 	$template->param(  'edit'   ) ) {
 	$template->param( seflag => 1);
 }
-- 
1.5.5.GIT




More information about the Koha-patches mailing list