From a6457c14aad50ad3d1b0a855f0ce0875500f432e Mon Sep 17 00:00:00 2001 From: Andreas Jonsson Date: Wed, 3 Jul 2024 13:15:40 +0000 Subject: [PATCH] Bug 37244: Facets should not impact library pulldown. When parsing the branch limits the regular expression matches parameters that contains the substring "branch:" rather than the prefix "^branch:". Consequently, both prefixes homebranch: and holdingbranch: triggers the branch limit. Test plan: - Activate the system preference IntranetAddMastheadLibraryPulldown. - In staff interface: - Perform a catalogue search (e.g. "book"). - Click on a facet for holding library or home library (e.g. "Fairview"). - Click on the "more options" icon in the search box and make sure that "All libraries" is selected. - Activate the system preference OpacAddMastheadLibraryPulldown - In opac: - Perform a catalogue search (e.g. "book"). - Click on a facet for holding library or home library (e.g. "Fairview"). - Make sure "All libraries" is still selected in the dropdown next to the search input. Signed-off-by: Chris Cormack Signed-off-by: Matt Blenkinsop Signed-off-by: Katrin Fischer --- C4/Auth.pm | 6 +++--- catalogue/search.pl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 57c05778d1..40ef948a33 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -554,9 +554,9 @@ sub get_template_and_user { my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'}; my $opac_name = ''; if ( - ( $opac_limit_override && $opac_search_limit && $opac_search_limit =~ /branch:([\w-]+)/ ) || - ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:([\w-]+)/ ) || - ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /multibranchlimit:(\w+)/ ) + ( $opac_limit_override && $opac_search_limit && $opac_search_limit =~ /^branch:([\w-]+)/ ) || + ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /^branch:([\w-]+)/ ) || + ( $in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /^multibranchlimit:(\w+)/ ) ) { $opac_name = $1; # opac_search_limit is a branch, so we use it. } elsif ( $in->{'query'}->param('multibranchlimit') ) { diff --git a/catalogue/search.pl b/catalogue/search.pl index ea37a2fa22..7c9bb22126 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -243,7 +243,7 @@ my @search_groups = my $branch_limit = ''; my $limit_param = $cgi->param('limit'); -if ( $limit_param and $limit_param =~ /branch:([\w-]+)/ ) { +if ( $limit_param and $limit_param =~ /^branch:([\w-]+)/ ) { $branch_limit = $1; } -- 2.39.5