Bug 24295: Remove GetTransfers from request.pl
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 15 Mar 2021 16:15:22 +0000 (16:15 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 26 Aug 2022 18:42:22 +0000 (15:42 -0300)
This patch replaces the call to GetTransfers in reserve.pl 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 reserves page for the display of the current transfer
   status
4/ Apply patch
5/ Repeat step 3

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>
reserve/request.pl

index 8c64f43..5fcb7ad 100755 (executable)
@@ -37,7 +37,7 @@ use C4::Reserves qw( RevertWaitingStatus AlterPriority ToggleLowestPriority Togg
 use C4::Items qw( get_hostitemnumbers_of );
 use C4::Koha qw( getitemtypeimagelocation );
 use C4::Serials qw( CountSubscriptionFromBiblionumber );
-use C4::Circulation qw( GetTransfers _GetCircControlBranch GetBranchItemRule );
+use C4::Circulation qw( _GetCircControlBranch GetBranchItemRule );
 use Koha::DateUtils qw( dt_from_string );
 use C4::Search qw( enabled_staff_search_views );
 
@@ -450,13 +450,11 @@ if (   ( $findborrower && $borrowernumber_hold || $findclub && $club_hold )
                 }
 
                 # Check the transit status
-                my ( $transfertwhen, $transfertfrom, $transfertto ) =
-                  GetTransfers($item_object->itemnumber); # FIXME replace with get_transfer
-
-                if ( defined $transfertwhen && $transfertwhen ne '' ) {
-                    $item->{transfertwhen} = $transfertwhen;
-                    $item->{transfertfrom} = $transfertfrom;
-                    $item->{transfertto} = $transfertto;
+                my $transfer = $item_object->get_transfer;
+                if ( $transfer && $transfer->in_transit ) {
+                    $item->{transfertwhen} = $transfer->datesent;
+                    $item->{transfertfrom} = $transfer->frombranch;
+                    $item->{transfertto} = $transfer->tobranch;
                     $item->{nocancel} = 1;
                 }