From chrisc@koha.wgtn.cat-it.co.nz Mon Apr 11 22:05:57 2011
Return-Path: <chrisc@koha.wgtn.cat-it.co.nz>
X-Original-To: chrisc@catalyst.net.nz
Delivered-To: chrisc@catalyst.net.nz
Received: from localhost (localhost [127.0.0.1])
	by mail.catalyst.net.nz (Postfix) with ESMTP id 7C92A3217E;
	Mon, 11 Apr 2011 22:05:57 +1200 (NZST)
X-Virus-Scanned: Debian amavisd-new at catalyst.net.nz
Received: from mail.catalyst.net.nz ([127.0.0.1])
	by localhost (bertrand.catalyst.net.nz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id KhO1L3JCht0Z; Mon, 11 Apr 2011 22:05:56 +1200 (NZST)
Received: from koha.wgtn.cat-it.co.nz (h241-244.catalyst.net.nz [202.78.241.244])
	by mail.catalyst.net.nz (Postfix) with ESMTPS id AF85632161;
	Mon, 11 Apr 2011 22:05:56 +1200 (NZST)
Received: from chrisc by koha.wgtn.cat-it.co.nz with local (Exim 4.69)
	(envelope-from <chrisc@koha>)
	id 1Q9E0B-0001ks-HB; Mon, 11 Apr 2011 22:05:54 +1200
From: Chris Cormack <chrisc@catalyst.net.nz>
To: koha-patches@lists.koha-community.org
Cc: Chris Cormack <chrisc@catalyst.net.nz>
Subject: [PATCH] Bug 6155 : Fixing bug with lists not showing
Date: Mon, 11 Apr 2011 22:05:47 +1200
Message-Id: <1302516347-6676-1-git-send-email-chrisc@catalyst.net.nz>
X-Mailer: git-send-email 1.5.6.5
Status: RO
Content-Length: 2674

---
 C4/VirtualShelves/Page.pm |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index df7054e..cb55b9c 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -57,6 +57,8 @@ sub shelfpage ($$$$$) {
     $query            or die "No query";
     $template         or die "No template";
     $template->param( { loggedinuser => $loggedinuser } );
+    my $edit;
+    my $shelves;
     my @paramsloop;
     my $totitems;
     my $shelfoff    = ( $query->param('shelfoff') ? $query->param('shelfoff') : 1 );
@@ -163,6 +165,7 @@ sub shelfpage ($$$$$) {
                 my ( $shelfnumber2, $shelfname, $owner, $category, $sortfield ) = GetShelf($shelfnumber);
                 my $member = GetMember( 'borrowernumber' => $owner );
                 my $ownername = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
+                $edit = 1;
                 $template->param(
                     edit                => 1,
                     shelfnumber         => $shelfnumber2,
@@ -312,7 +315,7 @@ sub shelfpage ($$$$$) {
                 $stay = 0;
             }
             $showadd = 1;
-            $stay and $template->param( shelves => 1 );
+            $stay and $template->param( shelves => 1 ) and $shelves = 1;
             last SWITCH;
         }
     }
@@ -359,7 +362,7 @@ sub shelfpage ($$$$$) {
         $qhash{$_} = $query->param($_) if $query->param($_);
     }
     ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash;
-    if ( $query->param('viewshelf') ) {
+    if ( $shelfnumber ) {
         $template->param( { pagination_bar => pagination_bar( $url, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), $itemoff, "itemoff" ) } );
     } else {
         $template->param(
@@ -373,13 +376,13 @@ sub shelfpage ($$$$$) {
         "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
         csv_profiles                                                       => GetCsvProfilesLoop()
     );
-    if (   $template->param('viewshelf')
-        or $template->param('shelves')
-        or $template->param('edit') ) {
+    if (   $shelfnumber
+        or $shelves
+        or $edit ) {
         $template->param( vseflag => 1 );
     }
-    if ($template->param('shelves') or    # note: this part looks duplicative, but is intentional
-        $template->param('edit')
+    if ($shelves or    # note: this part looks duplicative, but is intentional
+        $edit
       ) {
         $template->param( seflag => 1 );
     }
-- 
1.5.6.5