Browse Source

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>
18.11.x
Jonathan Druart 6 years ago
committed by Nick Clemens
parent
commit
5530ed6b9d
  1. 7
      opac/opac-suggestions.pl

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

Loading…
Cancel
Save