From 7e025fde1ae976cb12d4593b33579e12f5b284ec 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 Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- 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.39.5