Prevent compilation errors from complex C4 import/export.
[koha_fer] / C4 / VirtualShelves.pm
index fbb100d..3a9efd0 100644 (file)
@@ -27,6 +27,7 @@ use C4::Context;
 use C4::Circulation;
 use C4::Debug;
 use C4::Members;
+require C4::Auth;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
@@ -36,21 +37,18 @@ BEGIN {
        require Exporter;
        @ISA    = qw(Exporter);
        @EXPORT = qw(
-        &GetShelves &GetShelfContents &GetShelf
-               &GetRecentShelves &GetShelvesSummary
-
-        &AddToShelf &AddToShelfFromBiblio &AddShelf
-
-               &SetShelvesLimit
-               &RefreshShelvesSummary
-
-        &ModShelf
-        &ShelfPossibleAction
-        &DelFromShelf &DelShelf
+            &GetShelves &GetShelfContents &GetShelf
+            &AddToShelf &AddToShelfFromBiblio &AddShelf
+            &ModShelf
+            &ShelfPossibleAction
+            &DelFromShelf &DelShelf
        );
+        @EXPORT_OK = qw(
+            &GetShelvesSummary &GetRecentShelves
+            &RefreshShelvesSummary &SetShelvesLimit
+        );
 }
 
-use C4::Auth qw(get_session);
 
 my $dbh = C4::Context->dbh;
 
@@ -476,7 +474,7 @@ sub ShelfPossibleAction {
        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 (($category >= 2) and defined($user) and $borrower->{authflags}->{superlibrarian});    # public list, superlibrarian can edit/delete
+    return 1 if (($category >= 2) and defined($user) and ($borrower->{authflags}->{superlibrarian} || $user == 0));    # public list, superlibrarian can edit/delete
     return 1 if (defined($user)  and $owner  eq $user );       # user owns this list.  Check last.
     return 0;
 }
@@ -546,7 +544,7 @@ This function is used in conjunction with the 'Lists' button in masthead.inc.
 sub RefreshShelvesSummary ($$$) {
        
        my ($sessionID, $loggedinuser, $row_count) = @_;
-       my $session = get_session($sessionID);
+       my $session = C4::Auth::get_session($sessionID);
        my ($total, $totshelves, $barshelves, $pubshelves);
 
        ($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $loggedinuser);
@@ -555,13 +553,13 @@ sub RefreshShelvesSummary ($$$) {
        $total->{'pubtotal'} = $totshelves;
 
        # Update the current session with the latest shelves...
-       $session->param('barshelves', ${@$barshelves}[0]);
-       $session->param('pubshelves', ${@$pubshelves}[0]);
+       $session->param('barshelves', $barshelves->[0]);
+       $session->param('pubshelves', $pubshelves->[0]);
        $session->param('totshelves', $total);
 
        # likewise the userenv...
-       C4::Context->set_shelves_userenv('bar',${@$barshelves}[0]);
-       C4::Context->set_shelves_userenv('pub',${@$pubshelves}[0]);
+       C4::Context->set_shelves_userenv('bar',$barshelves->[0]);
+       C4::Context->set_shelves_userenv('pub',$pubshelves->[0]);
        C4::Context::set_shelves_userenv('tot',$total);
 
        return ($total, $pubshelves, $barshelves);