@@ -, +, @@ --- C4/Auth.pm | 4 +++- C4/XSLT.pm | 2 +- opac/opac-reserve.pl | 2 +- t/Koha.t | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -457,6 +457,7 @@ sub get_template_and_user { my $minPasswordLength = C4::Context->preference('minPasswordLength'); $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3; + my $singleLibraryMode = Koha::Libraries->single_library_mode; $template->param( EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'), GoogleJackets => C4::Context->preference("GoogleJackets"), @@ -469,7 +470,8 @@ sub get_template_and_user { hide_marc => C4::Context->preference("hide_marc"), item_level_itypes => C4::Context->preference('item-level_itypes'), patronimages => C4::Context->preference("patronimages"), - singleBranchMode => ( Koha::Libraries->search->count == 1 ), + singleBranchMode => $singleLibraryMode, #TODO one day our templates will only contain Library, and this can be removed + singleLibraryMode => $singleLibraryMode, noItemTypeImages => C4::Context->preference("noItemTypeImages"), marcflavour => C4::Context->preference("marcflavour"), OPACBaseURL => C4::Context->preference('OPACBaseURL'), --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -107,7 +107,7 @@ sub get_xslt_sysprefs { # singleBranchMode was a system preference, but no longer is # we can retain it here for compatibility - my $singleBranchMode = Koha::Libraries->search->count == 1 ? 1 : 0; + my $singleBranchMode = Koha::Libraries->single_library_mode; $sysxml .= "$singleBranchMode\n"; $sysxml .= "\n"; --- a/opac/opac-reserve.pl +++ a/opac/opac-reserve.pl @@ -226,7 +226,7 @@ if ( $query->param('place_reserve') ) { my $canreserve = 0; - my $singleBranchMode = Koha::Libraries->search->count == 1; + my $singleBranchMode = Koha::Libraries->single_library_mode; if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") ) { # single branch mode or disabled user choosing $branch = $patron->branchcode; --- a/t/Koha.t +++ a/t/Koha.t @@ -113,12 +113,12 @@ is( C4::Koha::GetNormalizedOCLCNumber(), undef, 'GetNormalizedOCLCNumber should subtest 'getFacets() tests' => sub { plan tests => 5; - is ( Koha::Libraries->search->count, 1, 'There should be only 1 library (singleBranchMode on)' ); + is ( Koha::Libraries->search->count, 1, 'There should be only 1 library' ); my $facets = C4::Koha::getFacets(); is( scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), 1, - 'location facet present with singleBranchMode on (bug 10078)' + 'location facet present with one library (bug 10078)' ); $libraries = [ @@ -126,13 +126,13 @@ subtest 'getFacets() tests' => sub { ['ZZZ_test', 'my branchname XXX'], ]; fixtures($libraries); - is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' ); + is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library' ); $facets = C4::Koha::getFacets(); is( scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), 1, - 'location facet present with singleBranchMode off (bug 10078)' + 'location facet present with >1 library (bug 10078)' ); }; --