Bug 22813: (follow-up) Add missing condition

This patch restores a missing condition. $patron gets renamed to make
it obvious that it related to the logged in user.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2019-04-30 15:48:14 -03:00 committed by Nick Clemens
parent 10efe4e3f2
commit 45b1ff8dfa
1 changed files with 6 additions and 4 deletions

View File

@ -1923,10 +1923,11 @@ sub searchResults {
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
my $userenv = C4::Context->userenv;
my $patron = ( defined $userenv and $userenv->{number} )
? Koha::Patrons->find( $userenv->{number} )
: undef;
my $patron_category_hide_lost_items = ($patron) ? $patron->category->hidelostitems : 0;
my $logged_in_user
= ( defined $userenv and $userenv->{number} )
? Koha::Patrons->find( $userenv->{number} )
: undef;
my $patron_category_hide_lost_items = ($logged_in_user) ? $logged_in_user->category->hidelostitems : 0;
# loop through all of the records we've retrieved
for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) {
@ -2119,6 +2120,7 @@ sub searchResults {
my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber};
# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item
if ( $item->{onloan}
and $logged_in_user
and !( $patron_category_hide_lost_items and $item->{itemlost} ) )
{
$onloan_count++;