From dfb2c774353ad609cb112f317feb67d74d30230d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 3 Jun 2010 13:54:21 -0400 Subject: [PATCH] Fix for Bug 3770, 'Add to list' page only allows adding to private lists This patch is a reformat of chad@pennmanor.net's submission to the bug report on 2010-02-16. Signed-off-by: Galen Charlton --- virtualshelves/addbybiblionumber.pl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/virtualshelves/addbybiblionumber.pl b/virtualshelves/addbybiblionumber.pl index d53a8c4e82..7af17c8ef3 100755 --- a/virtualshelves/addbybiblionumber.pl +++ b/virtualshelves/addbybiblionumber.pl @@ -153,18 +153,17 @@ if ( $shelfnumber || ( $shelfnumber == -1 ) ) { # the shelf already exist. } else { # this shelf doesn't already exist. my $limit = 10; - my ($shelflist) = GetRecentShelves(1, $limit, $loggedinuser); + my ($shelflist); my @shelvesloop; my %shelvesloop; - for my $shelf ( @{ $shelflist->[0] } ) { - push( @shelvesloop, $shelf->{shelfnumber} ); - $shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname}; - } - # then open shelves... - ($shelflist) = GetRecentShelves(3, $limit, undef); - for my $shelf ( @{ $shelflist->[0] } ) { - push( @shelvesloop, $shelf->{shelfnumber} ); - $shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname}; + + #grab each type of shelf, open (type 3) should not be limited by user. + foreach my $shelftype (1,2,3) { + my ($shelflist) = GetRecentShelves($shelftype, $limit, $shelftype == 3 ? undef : $loggedinuser); + for my $shelf (@{ $shelflist->[0] }) { + push(@shelvesloop, $shelf->{shelfnumber}); + $shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname}; + } } if(@shelvesloop gt 0){ -- 2.39.5