From 8e7bd44f9446524d3d21c1d3868af2891dba812f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 30 Apr 2019 15:48:14 -0300 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 45b1ff8dfa1054590544caff200b307144bd02cf) Signed-off-by: Martin Renvoize Signed-off-by: Lucas Gass --- C4/Search.pm | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 211e1fe..d2e1ce1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1910,10 +1910,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++ ) { @@ -2102,6 +2103,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++; -- 1.7.2.5