use C4::Circulation;
use C4::Debug;
use C4::Members;
+require C4::Auth;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
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;
=cut
-sub GetShelfContents ($$;$$) {
+sub GetShelfContents ($;$$$) {
my ($shelfnumber, $row_count, $offset, $sortfield) = @_;
my $dbh=C4::Context->dbh();
my $sth1 = $dbh->prepare("SELECT count(*) FROM virtualshelfcontents WHERE shelfnumber = ?");
($sortfield) = $sth2->fetchrow_array;
}
my $query =
- " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded,
- biblio.*, biblioitems.itemtype, itemtypes.*
+ " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*,
+ biblio.*, biblioitems.itemtype, biblioitems.publicationyear
FROM virtualshelfcontents vc
LEFT JOIN biblio ON vc.biblionumber = biblio.biblionumber
LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber
$query .= " DESC " if ($sortfield eq 'copyrightdate');
push (@params, $sortfield);
}
- $query .= " LIMIT ?, ? ";
- push (@params, ($offset ? $offset : 0));
- push (@params, $row_count);
+ if($row_count){
+ $query .= " LIMIT ?, ? ";
+ push (@params, ($offset ? $offset : 0));
+ push (@params, $row_count);
+ }
my $sth3 = $dbh->prepare($query);
$sth3->execute(@params);
return ($sth3->fetchall_arrayref({}), $total);
$sth->execute($shelfnumber);
my ( $owner, $category ) = $sth->fetchrow;
my $borrower = GetMemberDetails($user);
+ return 0 if not defined($user);
return 1 if ( $category >= 3); # open list
return 1 if (($category >= 2) and
defined($action) and $action eq 'view'); # public list, anybody can view
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);
$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);