From f7d5759a0d0f60b1446ec24d886961e2fe58c845 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Andr=C3=A9=20Santoni?= Date: Fri, 28 Aug 2009 23:47:52 +0200 Subject: [PATCH] (bug #3555) This sets the default branch to the logged user branch when IndependantBranches is active In the advanced search form, when IndependantBranches is activated, the default branch should be set to the logged user branch. --- catalogue/search.pl | 7 ++++++- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 85981afbb3..ea3d323c90 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -206,8 +206,13 @@ if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { my $branches = GetBranches(); my @branch_loop; +# we need to know the borrower branch code to set a default branch +my $borrowerbranchcode = C4::Context->userenv->{'branch'}; + for my $branch_hash (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { - push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, }; + # if independantbranches is activated, set the default branch to the borrower branch + my $selected = (C4::Context->preference("independantbranches") and ($borrowerbranchcode eq $branch_hash)) ? 1 : undef; + push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, selected => $selected}; } my $categories = GetBranchCategories(undef,'searchdomain'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl index c51ef15307..d5fb4622c8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl @@ -257,7 +257,11 @@ -- 2.11.0