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 <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 7e025fde1a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2018-05-28 16:36:54 -03:00 committed by Fridolin Somers
parent 7a6d958bf3
commit d65b20c673
1 changed files with 1 additions and 6 deletions

View File

@ -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} )
{