use C4::Members;
use C4::Koha;
use C4::Branch; # GetBranches
-use C4::VirtualShelves 3.02 qw(GetShelvesSummary);
+use C4::VirtualShelves;
# use utf8;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap);
$template->param( loggedinusername => $user );
$template->param( sessionID => $sessionID );
- my ($pubshelves, $barshelves);
- if (($pubshelves, $barshelves) = C4::Context->get_shelves_userenv()) {
- $template->param( barshelves => scalar (@$barshelves));
- $template->param( pubshelves => scalar (@$pubshelves));
- $template->param( barshelvesloop => $barshelves);
- $template->param( pubshelvesloop => $pubshelves);
+ my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv();
+ if (defined($pubshelves)) {
+ $template->param( pubshelves => scalar (@$pubshelves),
+ pubshelvesloop => $pubshelves,
+ );
+ $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves));
+ }
+ if (defined($barshelves)) {
+ $template->param( barshelves => scalar (@$barshelves),
+ barshelvesloop => $barshelves,
+ );
+ $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@$barshelves));
}
$borrowernumber = getborrowernumber($user);
- my ( $borr, $alternativeflags ) =
- GetMemberDetails( $borrowernumber );
+ my ( $borr ) = GetMemberDetails( $borrowernumber );
my @bordat;
$bordat[0] = $borr;
$template->param( "USER_INFO" => \@bordat );
$template->param( sessionID => $sessionID );
- my ($pubshelves); # an anonymous user has no 'barshelves'...
- if (($pubshelves) = C4::Context->get_shelves_userenv()) {
- $template->param( pubshelves => scalar (@$pubshelves));
- $template->param( pubshelvesloop => $pubshelves);
+ my ($total, $pubshelves) = C4::Context->get_shelves_userenv(); # an anonymous user has no 'barshelves'...
+ if (defined(($pubshelves))) {
+ $template->param( pubshelves => scalar (@$pubshelves),
+ pubshelvesloop => $pubshelves,
+ );
+ $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves));
}
}
opaccredits => "" . C4::Context->preference("opaccredits"),
opacheader => "" . C4::Context->preference("opacheader"),
opaclanguagesdisplay => "". C4::Context->preference("opaclanguagesdisplay"),
- opaclargeimage => "" . C4::Context->preference("opaclargeimage"),
opaclayoutstylesheet => "". C4::Context->preference("opaclayoutstylesheet"),
opacreadinghistory => C4::Context->preference("opacreadinghistory"),
opacsmallimage => "" . C4::Context->preference("opacsmallimage"),
my $version;
# If Version syspref is unavailable, it means Koha is beeing installed,
# and so we must redirect to OPAC maintenance page or to the WebInstaller
- #warn "about to check version";
+ # also, if OpacMaintenance is ON, OPAC should redirect to maintenance
+ if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') {
+ warn "OPAC Install required, redirecting to maintenance";
+ print $query->redirect("/cgi-bin/koha/maintenance.pl");
+ }
unless ($version = C4::Context->preference('Version')) { # assignment, not comparison
if ($type ne 'opac') {
warn "Install required, redirecting to Installer";
);
C4::Context::set_shelves_userenv('bar',$session->param('barshelves'));
C4::Context::set_shelves_userenv('pub',$session->param('pubshelves'));
+ C4::Context::set_shelves_userenv('tot',$session->param('totshelves'));
$debug and printf STDERR "AUTH_SESSION: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ;
$ip = $session->param('ip');
$lasttime = $session->param('lasttime');
$session->param('emailaddress'), $session->param('branchprinter')
);
- # Grab borrower's shelves and add to the session...
- $barshelves = GetShelvesSummary($borrowernumber,2,10);
- $session->param('barshelves', $barshelves);
- C4::Context::set_shelves_userenv('bar',$barshelves);
-
- # Grab the public shelves and add to the session...
- $pubshelves = GetShelvesSummary(0,2,10);
- $session->param('pubshelves', $pubshelves);
- C4::Context::set_shelves_userenv('pub',$pubshelves);
+ # Grab borrower's shelves and public shelves and add them to the session
+ # $row_count determines how many records are returned from the db query
+ # and the number of lists to be displayed of each type in the 'Lists' button drop down
+ my $row_count = 10; # FIXME:This probably should be a syspref
+ my ($total, $totshelves, $barshelves, $pubshelves);
+ ($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $borrowernumber);
+ $total->{'bartotal'} = $totshelves;
+ ($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+ $total->{'pubtotal'} = $totshelves;
+ $session->param('barshelves', $barshelves->[0]);
+ $session->param('pubshelves', $pubshelves->[0]);
+ $session->param('totshelves', $total);
+
+ C4::Context::set_shelves_userenv('bar',$barshelves->[0]);
+ C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
+ C4::Context::set_shelves_userenv('tot',$total);
}
else {
if ($userid) {
$debug and warn "Initiating an anonymous session...";
# Grab the public shelves and add to the session...
- $pubshelves = GetShelvesSummary(0,2,10);
- $session->param('pubshelves', $pubshelves);
- C4::Context::set_shelves_userenv('pub',$pubshelves);
+ my $row_count = 20; # FIXME:This probably should be a syspref
+ my ($total, $totshelves, $pubshelves);
+ ($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+ $total->{'pubtotal'} = $totshelves;
+ $session->param('pubshelves', $pubshelves->[0]);
+ $session->param('totshelves', $total);
+ C4::Context::set_shelves_userenv('pub',$pubshelves->[0]);
+ C4::Context::set_shelves_userenv('tot',$total);
# setting a couple of other session vars...
$session->param('ip',$session->remote_addr());
INPUTS => \@inputs,
suggestion => C4::Context->preference("suggestion"),
virtualshelves => C4::Context->preference("virtualshelves"),
- opaclargeimage => C4::Context->preference("opaclargeimage"),
LibraryName => C4::Context->preference("LibraryName"),
opacuserlogin => C4::Context->preference("opacuserlogin"),
OpacNav => C4::Context->preference("OpacNav"),
OpacAuthorities => C4::Context->preference("OpacAuthorities"),
OpacBrowser => C4::Context->preference("OpacBrowser"),
opacheader => C4::Context->preference("opacheader"),
+ TagsEnabled => C4::Context->preference("TagsEnabled"),
OPACUserCSS => C4::Context->preference("OPACUserCSS"),
intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),