From 26af5bff76a4b8c6e3d3615991fd59ef0a18a35f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 28 May 2018 16:36:54 -0300 Subject: [PATCH] Bug 20763: Remove unecessary Koha::Patron fetch If $borrowernumber is not set, there is no userenv. So let's pick the library code set in the userenv instead of fetching the Koha::Patron->branchcode from DB Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- opac/opac-suggestions.pl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index c29278cf89..19493aae99 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -198,12 +198,7 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) { my $branchcode = $input->param('branchcode') || q{}; - if ( !$branchcode && $borrowernumber ) { - my $patron = Koha::Patrons->find($borrowernumber); - $branchcode = $patron->branchcode; - } - - if ( !$branchcode + if ( !$branchcode && C4::Context->userenv && C4::Context->userenv->{branch} ) { -- 2.15.1 (Apple Git-101)