From 5c7283d0cf7f4b8689d6926e2b9a73fd26739c75 Mon Sep 17 00:00:00 2001 From: =?utf8?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. Signed-off-by: Henri-Damien LAURENT --- catalogue/search.pl | 7 ++++++- .../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 a5beb6d0b4..0fff659713 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 7bff1f1c63..2bed3147bc 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.39.5