Bug 28955: Add OPAC_BRANCH_DEFAULT

This patch adds support for OPAC_BRANCH_DEFAULT as an environment option
that can be passed via apache with either SetEnv or as a header for
plack.  It allows setting a default branch for the anonymous opac
session such that you can display the right opac content blocks prior to
login if you have set up per branch URI's.

To test (on top of bug 29691)
1 - Add to apache conf (/etc/apache2/sites-available/kohadev.conf)
    SetEnv OPAC_BRANCH_DEFAULT "CPL"
    RequestHeader add X-Koha-SetEnv "OPAC_BRANCH_DEFAULT CPL"
2 - Restart all
3 - Confirm that news for all and CPL show on opac mainpage
4 - Sign in as a different library
5 - Confirm users library news shows

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Martin Renvoize 2021-10-27 11:27:18 +01:00 committed by Arthur Suzuki
parent 128673401c
commit c7491a6fe6
2 changed files with 4 additions and 0 deletions

View File

@ -456,6 +456,9 @@ sub get_template_and_user {
some_public_shelves => $some_public_shelves,
);
}
# Set default branch if one has been passed by the environment.
$template->param( branchcode => $ENV{OPAC_BRANCH_DEFAULT} ) if $ENV{OPAC_BRANCH_DEFAULT};
}
# Sysprefs disabled via URL param

View File

@ -66,6 +66,7 @@ name.
my $allowed_setenvs = qr/^(
OVERRIDE_SYSPREF_(\w+) |
OVERRIDE_SYSPREF_NAMES |
OPAC_BRANCH_DEFAULT |
OPAC_CSS_OVERRIDE |
OPAC_SEARCH_LIMIT |
OPAC_LIMIT_OVERRIDE |