bugfix for bug introduced by anonymous session code
authorChris Nighswonger <chris.nighswonger@liblime.com>
Fri, 20 Jun 2008 21:44:52 +0000 (16:44 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 20 Jun 2008 21:48:51 +0000 (16:48 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Auth.pm

index f7ae6d9..3426953 100755 (executable)
@@ -145,13 +145,15 @@ sub get_template_and_user {
         $template->param( loggedinusername => $user );
         $template->param( sessionID        => $sessionID );
 
-               my ($pubshelves, $barshelves);
-               if (($pubshelves, $barshelves) = C4::Context->get_shelves_userenv()) {
-               $template->param( barshelves     => scalar (@$barshelves));
+               my ($pubshelves, $barshelves) = C4::Context->get_shelves_userenv();
+               if (defined($pubshelves)) {
                $template->param( pubshelves     => scalar (@$pubshelves));
-               $template->param( barshelvesloop => $barshelves);
                $template->param( pubshelvesloop => $pubshelves);
                }
+               if (defined($barshelves)) {
+               $template->param( barshelves     => scalar (@$barshelves));
+               $template->param( barshelvesloop => $barshelves);
+               }
 
         $borrowernumber = getborrowernumber($user);
         my ( $borr, $alternativeflags ) =
@@ -239,8 +241,8 @@ sub get_template_and_user {
 
         $template->param( sessionID        => $sessionID );
                
-               my ($pubshelves);       # an anonymous user has no 'barshelves'...
-               if (($pubshelves) = C4::Context->get_shelves_userenv()) {
+               my ($pubshelves) = C4::Context->get_shelves_userenv();  # an anonymous user has no 'barshelves'...
+               if (defined(($pubshelves))) {
                $template->param( pubshelves     => scalar (@$pubshelves));
                $template->param( pubshelvesloop => $pubshelves);
                }