From 8b1c956e4705e525e0d006f0b0b9792bdc2cf5b4 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Rebased-by: Joonas Kylmälä Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize --- C4/Search.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 75da21a4e6..14935ab731 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1914,8 +1914,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} ); if ( C4::Context->preference('UseRecalls') ) { if ( Koha::Recalls->search({ item_id => $item->{itemnumber}, status => 'waiting' })->count ) { -- 2.20.1