This patch ensures that the OPAC library selection masthead will always default
to the branch that is currently being searched. This only applies to systems
with multiple branches and OpacAddMastheadLibraryPulldown turned on.
To test: do a search in the OPAC, limiting by branch. The search results will
still have that branch selected in the masthead dropdown.
This patch also fixes bug 5852 and bug 3778.
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Liz Rea <lrea@nekls.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
singleBranchMode => C4::Context->preference("singleBranchMode"),
XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
singleBranchMode => C4::Context->preference("singleBranchMode"),
XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
- BranchesLoop => GetBranchesLoop(),
using_https => $in->{'query'}->https() ? 1 : 0,
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
);
using_https => $in->{'query'}->https() ? 1 : 0,
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
);
# variables passed from CGI: opac_css_override and opac_search_limits.
my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
# variables passed from CGI: opac_css_override and opac_search_limits.
my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
- my $mylibraryfirst = C4::Context->preference("SearchMyLibraryFirst");
- my $opac_name;
- if($opac_limit_override && ($opac_search_limit =~ /branch:(\w+)/) ){
- $opac_name = C4::Branch::GetBranchName($1) # opac_search_limit is a branch, so we use it.
- } elsif($mylibraryfirst){
- $opac_name = C4::Branch::GetBranchName($mylibraryfirst);
+ my $opac_name = '';
+ if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){
+ $opac_name = $1; # opac_search_limit is a branch, so we use it.
+ } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
+ $opac_name = C4::Context->userenv->{'branch'};
}
$template->param(
AmazonContent => "" . C4::Context->preference("AmazonContent"),
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
}
$template->param(
AmazonContent => "" . C4::Context->preference("AmazonContent"),
AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"),
AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"),
+ BranchesLoop => GetBranchesLoop($opac_name),
LibraryName => "" . C4::Context->preference("LibraryName"),
LibraryNameTitle => "" . $LibraryNameTitle,
LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
LibraryName => "" . C4::Context->preference("LibraryName"),
LibraryNameTitle => "" . $LibraryNameTitle,
LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
OpacAuthorities => C4::Context->preference("OpacAuthorities"),
OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} .
($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"),
OpacAuthorities => C4::Context->preference("OpacAuthorities"),
OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} .
($ENV{'SERVER_PORT'} eq ($in->{'query'}->https() ? "443" : "80") ? '' : ":$ENV{'SERVER_PORT'}"),
- opac_name => $opac_name,
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
opac_search_limit => $opac_search_limit,
opac_limit_override => $opac_limit_override,
opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'},
opac_search_limit => $opac_search_limit,
opac_limit_override => $opac_limit_override,
<!-- /TMPL_LOOP -->
</select>
<!-- TMPL_ELSE -->
<!-- /TMPL_LOOP -->
</select>
<!-- TMPL_ELSE -->
- <!-- TMPL_UNLESS NAME="opac_limit_override" -->
+ <!-- TMPL_IF NAME="opac_limit_override" -->
+ <!-- TMPL_IF NAME="opac_search_limit" -->
+ <input name="limit" value="<!-- TMPL_VAR name="opac_search_limit" -->" type="hidden" />
+ <!-- /TMPL_IF -->
+ <!-- TMPL_ELSE -->
<!-- TMPL_IF name="mylibraryfirst" -->
<input name="limit" value="branch:<!-- TMPL_VAR name="mylibraryfirst" -->" type="hidden" />
<!-- /TMPL_IF -->
<!-- TMPL_IF name="mylibraryfirst" -->
<input name="limit" value="branch:<!-- TMPL_VAR name="mylibraryfirst" -->" type="hidden" />
<!-- /TMPL_IF -->
- <!-- /TMPL_UNLESS -->
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="opac_search_limit" -->
- <input name="limit" value="<!-- TMPL_VAR name="opac_search_limit" -->" type="hidden" />
<select name="limit" id="branchloop">
<option value="">All libraries</option>
<select name="limit" id="branchloop">
<option value="">All libraries</option>
- <!-- TMPL_LOOP NAME="branchloop" -->
+ <!-- TMPL_LOOP NAME="BranchesLoop" -->
<!--TMPL_IF Name="selected"-->
<option value="branch:<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
<!--TMPL_ELSE-->
<!--TMPL_IF Name="selected"-->
<option value="branch:<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
<!--TMPL_ELSE-->
-my $mybranch = ( C4::Context->preference('SearchMyLibraryFirst') && C4::Context->userenv && C4::Context->userenv->{branch} ) ? C4::Context->userenv->{branch} : '';
my $branches = GetBranches(); # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
$template->param(
my $branches = GetBranches(); # used later in *getRecords, probably should be internalized by those functions after caching in C4::Branch is established
$template->param(
- branchloop => GetBranchesLoop($mybranch, 0),
searchdomainloop => GetBranchCategories(undef,'searchdomain'),
);
searchdomainloop => GetBranchCategories(undef,'searchdomain'),
);