From 451ab9e77ee4aa99fd8d07271fd77492d3d6fc8c Mon Sep 17 00:00:00 2001 From: Michael Hafen Date: Tue, 28 Apr 2009 14:16:31 -0600 Subject: [PATCH] OPAC Advanced Search - have user's branch selected by default If SearchMyLibraryFirst is on, and the user is logged in, then have their branch selected in the Location And Availability drop-down. Signed-off-by: Galen Charlton --- opac/opac-search.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index f32ffc3eed..a20041e9cd 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -115,10 +115,15 @@ if (C4::Context->preference('TagsEnabled')) { #} # load the branches +my $mybranch = ( C4::Context->preference( 'SearchMyLibraryFirst' ) && C4::Context->userenv ) ? C4::Context->userenv->{branch} : ''; my $branches = GetBranches(); # FIXME: next line duplicates GetBranchesLoop(0,0); my @branch_loop = map { - {value => $_, branchname => $branches->{$_}->{branchname}} + { + value => $_, + branchname => $branches->{$_}->{branchname}, + selected => ( $mybranch eq $_ ) ? 1 : 0 + } } sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches; -- 2.11.0