From d344937e2789a54c61721c4678122cdc1c6e5a31 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 19 Apr 2021 15:59:57 +0100 Subject: [PATCH] Bug 24295: Remove GetTransfers from C4/Search.pm This patch removes the final use of GetTransfers from C4::Search. Test plan 1/ Perform a search that will include results for some items that have transfers of various states assigned to them 2/ Check the results match expectations (before and after applying the patch should look the same) 3/ Signoff --- C4/Search.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index a4fafd1e01..8b0fe986f3 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1931,8 +1931,16 @@ sub searchResults { # FIXME: to avoid having the query the database like this, and to make # the in transit status count as unavailable for search limiting, # should map transit status to record indexed in Zebra. - # - ($transfertwhen, $transfertfrom, $transfertto) = C4::Circulation::GetTransfers($item->{itemnumber}); + + my $item_object = Koha::Items->find($item->{itemnumber}); + my $transfer = defined($item_object) ? $item_object->get_transfer : undef; + ( $transfertwhen, $transfertfrom, $transfertto ) = + defined($transfer) + ? ( + $transfer->datesent, $transfer->frombranch, + $transfer->tobranch + ) + : ( '', '', '' ); $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); } -- 2.20.1