@@ -, +, @@ --- C4/Search.pm | 13 +++++++------ C4/XSLT.pm | 7 ++++--- 2 files changed, 11 insertions(+), 9 deletions(-) --- a/C4/Search.pm +++ a/C4/Search.pm @@ -1832,8 +1832,8 @@ sub searchResults { elsif ($item->{$otherbranch}) { # Last resort $item->{'branchname'} = $branches{$item->{$otherbranch}}; } - $item->{homebranch} = $branches{ $item->{homebranch} } if defined $item->{homebranch}; - $item->{holdingbranch} = $branches{ $item->{holdingbranch} } if defined $item->{holdingbranch}; + $item->{homebranch} &&= $branches{ $item->{homebranch} }; + $item->{holdingbranch} &&= $branches{ $item->{holdingbranch} }; my $prefix = ( $item->{$hbranch} ? $item->{$hbranch} . '--' : q{} ) @@ -1842,11 +1842,12 @@ sub searchResults { . ( $item->{itemcallnumber} ? $item->{itemcallnumber} : q{} ); # For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item my $itemtype = C4::Context->preference("item-level_itypes")? $item->{itype}: $oldbiblio->{itemtype}; - $item->{itemtype} = $itemtype; - $item->{location} = $item->{location} && exists $shelflocations->{$item->{location}} ? $shelflocations->{$item->{location}} : $item->{location} ; - $item->{notforloan_description} = exists $notforloan_descriptions->{ $item->{notforloan} } ? $notforloan_descriptions->{ $item->{notforloan} } : "Not for loan"; - $item->{ccode_description} = defined $item->{ccode} && exists $ccodes->{ $item->{ccode} } ? $ccodes->{ $item->{ccode} } : $item->{ccode}; + $item->{itemtype} = $itemtype; + $item->{location} = $shelflocations->{$item->{location}} || $item->{location} ; + $item->{notforloan_description} = $notforloan_descriptions->{ $item->{notforloan} } || "Not for loan"; + $item->{ccode_description} = $ccodes->{ $item->{ccode} } || $item->{ccode}; $item->{notforloan_itemtype} = defined $itemtype && exists $itemtypes{ $itemtype } ? $itemtypes{ $itemtype }->{notforloan} : undef; + if ( $item->{onloan} and $logged_in_user and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -334,8 +334,9 @@ sub buildKohaItemsNamespace { $recalls_count = Koha::Recalls->search({ item_id => $item->{itemnumber}, status => 'waiting' })->count; } - my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); - my $transfer = C4::Circulation::GetTransfers($item->{itemnumber}); + # Don't call GetReserveStatus if we don't need it + my $reservestatus = !$recalls_count ? C4::Reserves::GetReserveStatus( $item->{itemnumber} ) : undef; + if ($recalls_count) { # recalls take priority over holds @@ -350,7 +351,7 @@ sub buildKohaItemsNamespace { $status = 'other'; $substatus = 'Waiting'; } - elsif ($transfer) { + elsif (C4::Circulation::GetTransfers($item->{itemnumber})){ $status = 'other'; $substatus = 'In transit'; } --