From 8cb70683293791fb6ec64f462c5b67b776c73a2b Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Fri, 22 Feb 2013 17:21:15 +0100 Subject: [PATCH] Bug 6279 - Can't delete lists from the second page of lists in the OPAC When you're on the second page of lists and try to delete a list by opening the list you're presented with an error that the list cannot be found. This patch changes the way this error is triggered, instead of looking in shelves search list witch is empty when you open a shelf, uses GetShelf with self number. Also corrects the nopermission error. Test plan : - Connect to OPAC - Go to your lists - Create a new list with a name begining with a Z (to be in end of table) - Go to public lists last page (you may create more than 20 lists to get several pages) - Click on created list - Click on delete => your list is deleted and you come back to lists table - Come back to previous page with browser arrow - You see the list you have deleted - Click on delete => you get a message "ERROR: List number 99 unrecognized" --- C4/VirtualShelves/Page.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 586384d..82a4a20 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -338,16 +338,17 @@ sub shelfpage { #Deleting a shelf (asking for confirmation if it has entries) foreach ( $query->param() ) { /DEL-(\d+)/ or next; - $delflag = 1; my $number = $1; - unless ( defined $shelflist->{$number} || defined $privshelflist->{$number} ) { + my ($delnumber,$delname,$delowner,$delcategory,$delsorton) = GetShelf($number); + unless ( defined $delnumber ) { push( @paramsloop, { unrecognized => $number } ); last; } unless ( ShelfPossibleAction( $loggedinuser, $number, 'manage' ) ) { - push( @paramsloop, { nopermission => $shelfnumber } ); + push( @paramsloop, { nopermission => $number } ); last; } + $delflag = 1; my $contents; ( $contents, $totshelves ) = GetShelfContents( $number, $shelveslimit, $shelvesoffset ); if ( my $count = scalar @$contents ) { @@ -355,7 +356,7 @@ sub shelfpage { if ( defined $shelflist->{$number} ) { push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $count, single => ($count eq 1 ? 1:0) } ); $shelflist->{$number}->{confirm} = $number; - } else { + } elsif ( defined $privshelflist->{$number} ) { push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $count } ); $privshelflist->{$number}->{confirm} = $number; } @@ -367,7 +368,7 @@ sub shelfpage { if ( defined $shelflist->{$number} ) { $name = $shelflist->{$number}->{'shelfname'}; delete $shelflist->{$number}; - } else { + } elsif ( defined $privshelflist->{$number} ) { $name = $privshelflist->{$number}->{'shelfname'}; delete $privshelflist->{$number}; } -- 1.7.10.4