Fix for Bug 3770, 'Add to list' page only allows adding to private lists
authorOwen Leonard <oleonard@myacpl.org>
Thu, 3 Jun 2010 17:54:21 +0000 (13:54 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Fri, 4 Jun 2010 00:53:04 +0000 (20:53 -0400)
This patch is a reformat of chad@pennmanor.net's submission to
the bug report on 2010-02-16.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
virtualshelves/addbybiblionumber.pl

index d53a8c4..7af17c8 100755 (executable)
@@ -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){