From 645b9ba5613eefa0697bc794790637aebf52b1eb Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Mon, 15 Mar 2021 15:56:20 +0000
Subject: [PATCH] Bug 24295: Remove GetTransfers from opac-reserve.pl

This patch replaces the call to GetTransfers in opac-reserve with the
get_transfer method available from the Koha::Item object

Test plan
1/ Place a reserve on an item at a different branch
2/ Trigger the transfer of the item
3/ Check the opac-reserves page for the display of the current transfer
status
4/ Apply patch
5/ Repeat step 3
---
 opac/opac-reserve.pl | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index a6182400ad..0160a2a94e 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -537,12 +537,11 @@ foreach my $biblioNum (@biblionumbers) {
         }
 
         # Check of the transferred documents
-        my ( $transfertwhen, $transfertfrom, $transfertto ) =
-          GetTransfers($itemNum);
-        if ( $transfertwhen && ($transfertwhen ne '') ) {
-            $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 });
-            $itemLoopIter->{transfertfrom} = $transfertfrom;
-            $itemLoopIter->{transfertto} = $transfertto;
+        my $transfer = $item->get_transfer;
+        if ( $transfer->in_transit ) {
+            $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfer->datesent), dateonly => 1 });
+            $itemLoopIter->{transfertfrom} = $transfer->frombranch;
+            $itemLoopIter->{transfertto} = $transfer->tobranch;
             $itemLoopIter->{nocancel} = 1;
         }
 
-- 
2.20.1