From 02a4e24bc169d3d43e5255b845da06bf3d905cc9 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 27 Oct 2021 11:27:18 +0100 Subject: [PATCH] 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. --- C4/Auth.pm | 3 +++ Koha/Middleware/SetEnv.pm | 1 + 2 files changed, 4 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index a9bd7fe365..1452f3218c 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -438,6 +438,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 diff --git a/Koha/Middleware/SetEnv.pm b/Koha/Middleware/SetEnv.pm index 6807392c1a..27c91b6b05 100644 --- a/Koha/Middleware/SetEnv.pm +++ b/Koha/Middleware/SetEnv.pm @@ -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 | -- 2.20.1