From 5df3550faf111cd6a987148c03566f96a8a7ab82 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Wed, 26 Aug 2009 15:26:56 +0200 Subject: [PATCH] [3.0.x](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 ++++++- .../prog/en/modules/catalogue/advsearch.tmpl | 4 ++++ 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 503ed4f..d3217f8 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -208,8 +208,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 4d3aaad..3465c82 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 @@ -- 1.6.0.4