From f8181b8dd224c88c0fe25305e0097a012be02725 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 18 Feb 2014 07:43:44 -0500 Subject: [PATCH] Bug 11779 - Unexpected change in logged in branch 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 --- Koha/Template/Plugin/Branches.pm | 7 +++++++ .../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 343158c..6a66c8a 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 LoggedInBranchcode { + 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 388c467..c600c31 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 ) %]