From 245da0f19803f33fd3fd051f0f586e39f63e7eb5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 15 Mar 2021 15:56:20 +0000 Subject: [PATCH] Bug 24295: Remove GetTransfers from opac-reserve.pl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Rebased-by: Joonas Kylmälä Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- opac/opac-reserve.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 724a2ba354..4c9119540b 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -24,7 +24,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth qw( get_template_and_user ); use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc ); -use C4::Circulation qw( GetBranchItemRule GetTransfers ); +use C4::Circulation qw( GetBranchItemRule ); use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest ); use C4::Biblio qw( GetBiblioData GetFrameworkCode ); use C4::Output qw( output_html_with_http_headers ); @@ -481,12 +481,11 @@ foreach my $biblioNum (@biblionumbers) { $item_info->{checkout} = $item->checkout; # Check of the transferred documents - my ( $transfertwhen, $transfertfrom, $transfertto ) = - GetTransfers($item->itemnumber); - if ( $transfertwhen && ($transfertwhen ne '') ) { - $item_info->{transfertwhen} = $transfertwhen; - $item_info->{transfertfrom} = $transfertfrom; - $item_info->{transfertto} = $transfertto; + my $transfer = $item->get_transfer; + if ( $transfer && $transfer->in_transit ) { + $item_info->{transfertwhen} = $transfer->datesent; + $item_info->{transfertfrom} = $transfer->frombranch; + $item_info->{transfertto} = $transfer->tobranch; $item_info->{nocancel} = 1; } -- 2.39.5