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

Rebased-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2021-04-19 15:59:57 +01:00 committed by Tomas Cohen Arazi
parent 68f54437a3
commit f6c767677f
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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 ) {