From e70e3bcd6d801d6060d296b4af2719da7b806ea5 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Wed, 11 Jun 2008 16:28:44 -0500 Subject: [PATCH] Change order of checks, and avoid warnings if args undef (i.e. anonymous login). Signed-off-by: Joshua Ferraro --- C4/VirtualShelves.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 58430c379c..fc56284a64 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -381,9 +381,10 @@ sub ShelfPossibleAction { my $sth = $dbh->prepare($query); $sth->execute($shelfnumber); my ( $owner, $category ) = $sth->fetchrow; - return 1 if ($owner eq $user); - return 1 if ( $category >= 3); - return 1 if (($category >= 2) && $action eq 'view' ); + return 1 if ( $category >= 3); # open list + return 1 if (($category >= 2) and + defined($action) and $action eq 'view'); # public list, anybody can view + return 1 if (defined($user) and $owner eq $user ); # user owns this list. Check last. return 0; } -- 2.39.5