Browse Source

Bug 31775: Show single library

Test plan:
Check both cases: one library (public accessible) and more
libraries (public accessible). In the latter case click on
one of these libraries too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Marcel de Rooy 2 years ago
committed by Tomas Cohen Arazi
parent
commit
03129f718f
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 20
      opac/opac-library.pl

20
opac/opac-library.pl

@ -21,6 +21,7 @@ use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use Koha::Libraries;
@ -37,21 +38,20 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
}
);
my $found;
if ($branchcode) {
my $library = Koha::Libraries->find($branchcode);
if ( $library && $library->public ) {
$found++;
$template->param( library => $library );
}
my $library;
if( $template->{VARS}->{singleBranchMode} ) {
$library = Koha::Libraries->search({ public => 1 })->next;
} elsif( $branchcode ) {
$library = Koha::Libraries->search({ branchcode => $branchcode, public => 1 })->next;
}
unless ($found) {
if( $library ) {
$template->param( library => $library );
} else {
my $libraries = Koha::Libraries->search( { public => 1 }, { order_by => ['branchname'] } );
$template->param(
libraries => $libraries,
branchcode => $branchcode,
branchcode => C4::Context->userenv ? C4::Context->userenv->{branch} : q{},
);
}

Loading…
Cancel
Save