From 12eb3cb440b254c06d9fdb6026bca52d058dfb59 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Dec 2014 13:40:00 +0100 Subject: [PATCH] Bug 13418: Clean C4::VirtualShelves::Page - Part 2 I don't understand at all the usefulness of $privshelflist and $privtotshelves in C4::VirtualShelves::Page They look useless. If you deep in the git history, you will find commit 25eb36f21fe952118327d2c84dfef5d38eee31a7 Bug #2531 Cannot delete private shelf I am not able to reproduce this issue after this patch Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/VirtualShelves/Page.pm | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index 1e3e3518d7..a5b31644bb 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -75,14 +75,6 @@ sub shelfpage { my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset ); my $marcflavour = C4::Context->preference("marcflavour"); - # get biblionumbers stored in the cart - my @cart_list; - my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" ); - if($query->cookie($cart_cookie)){ - my $cart_list = $query->cookie($cart_cookie); - @cart_list = split(/\//, $cart_list); - } - $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 @@ -93,11 +85,6 @@ sub shelfpage { my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ); my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category ); - #Get a list of private shelves for possible deletion. Only do this when we've defaulted to public shelves - my ( $privshelflist, $privtotshelves ); - if ( $category == 2 ) { - ( $privshelflist, $privtotshelves ) = GetShelves( 1, $shelveslimit, $shelvesoffset, $loggedinuser ); - } my $op = $query->param('op'); # the format of this is unindented for ease of diff comparison to the old script @@ -260,6 +247,16 @@ sub shelfpage { direction => $direction, ); ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); + + # get biblionumbers stored in the cart + # Note that it's not use at the intranet + my @cart_list; + my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" ); + if($query->cookie($cart_cookie)){ + my $cart_list = $query->cookie($cart_cookie); + @cart_list = split(/\//, $cart_list); + } + for my $this_item (@$items) { my $biblionumber = $this_item->{'biblionumber'}; my $record = GetMarcBiblio($biblionumber); @@ -366,7 +363,7 @@ sub shelfpage { /(DEL|REMSHR)-(\d+)/ or next; $delflag = 1; my $number = $2; - unless ( defined $shelflist->{$number} || defined $privshelflist->{$number} ) { + unless ( defined $shelflist->{$number} ) { push( @paramsloop, { unrecognized => $number } ); last; } @@ -374,7 +371,6 @@ sub shelfpage { if(/REMSHR/) { RemoveShare($loggedinuser, $number); delete $shelflist->{$number} if exists $shelflist->{$number}; - delete $privshelflist->{$number} if exists $privshelflist->{$number}; $stay=0; next; } @@ -390,9 +386,6 @@ sub shelfpage { if ( defined $shelflist->{$number} ) { push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } ); $shelflist->{$number}->{confirm} = $number; - } else { - push( @paramsloop, { need_confirm => $privshelflist->{$number}->{shelfname}, count => $totshelves } ); - $privshelflist->{$number}->{confirm} = $number; } $stay = 0; next; @@ -402,9 +395,6 @@ sub shelfpage { if ( defined $shelflist->{$number} ) { $name = $shelflist->{$number}->{'shelfname'}; delete $shelflist->{$number}; - } else { - $name = $privshelflist->{$number}->{'shelfname'}; - delete $privshelflist->{$number}; } unless ( DelShelf($number) ) { push( @paramsloop, { delete_fail => $name } ); -- 2.39.5