From adcd09d92e613aa86e3a9dc865db4c9801a2138b 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 18a2977a97..4b5898261f 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1894,8 +1894,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