From f08154588cb07d8d85b25d13a566c2c689148577 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 18 Feb 2014 07:43:44 -0500 Subject: [PATCH] Bug 11779: fix unexpected change in logged-in library when changing overdue notice triggers Steps to reproduce: 1) Log into staff intranet 2) Set logged in branch 3) Browse to tools/overdue notice triggers 4) Select a branch from the pulldown that is not your logged in branch 5) use the "Check out" bar at the top of the page to search for a patron to check out to 6) Once you have landed here, click the "check out" tab link again, or the Edit button ( any action really ) 7) Note your logged in branch has now changed to the once selected when editing the notice/status triggers This is due to the way the patron search passes the branchcode to be used via the form. This form assumes the branchcode variable is always the currently logged in branch, which may not and is not always the case. Test Plan: 1) Apply this patch 2) Repeat the steps to reproduce above 3) Note your logged in branch does not change Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Funny bug :) This patch fixes the described issue and should not introduce regression. Signed-off-by: Galen Charlton (cherry picked from commit 858083c8e907bde4efa6842cd45ff91bf1f6e24f) Signed-off-by: Fridolin Somers --- Koha/Template/Plugin/Branches.pm | 7 +++++++ .../intranet-tmpl/prog/en/includes/patron-search-box.inc | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 343158cc16..d1801bee9d 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -24,6 +24,7 @@ use base qw( Template::Plugin ); use Encode qw{encode decode}; use C4::Koha; +use C4::Context; sub GetName { my ( $self, $branchcode ) = @_; @@ -35,4 +36,10 @@ sub GetName { return $b ? encode( 'UTF-8', $b->{'branchname'} ) : q{}; } +sub GetLoggedInBranchcode { + my ($self) = @_; + + return C4::Context->userenv->{'branch'} if C4::Context->userenv; +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc index 388c467f94..8e3bf66a3b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-box.inc @@ -1,3 +1,4 @@ +[% USE Branches %] [% IF ( CAN_user_circulate ) %][% IF ( CircAutocompl ) %]