From 8dab736b76fbe7ae2bbbc62a0e5a133076cbd56d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 15 Mar 2021 16:18:36 +0000 Subject: [PATCH] Bug 24295: Remove GetTransfers from detail.pl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch replaces the call to GetTransfers in detail.pl with the get_transfer method available from the Koha::Item object Test plan 1/ Trigger the transfer of the item 2/ Check the detail page for the display of the current transfer status 3/ Apply patch 4/ Repeat step 2 JK: Remove unneeded string formatting for transfertwhen as it's done on the template toolkit side already with $KohaDates Rebased-by: Joonas Kylmälä Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- catalogue/detail.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index f7595b0c2d..47a1391865 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -34,7 +34,6 @@ use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLat use C4::Output qw( output_html_with_http_headers ); use C4::Biblio qw( GetBiblioData GetFrameworkCode ); use C4::Items qw( GetAnalyticsCount ); -use C4::Circulation qw( GetTransfers ); use C4::Reserves; use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); use C4::XISBN qw( get_xisbns ); @@ -402,12 +401,12 @@ foreach my $item (@items) { $item_info->{checkout} = $item->checkout; # Check the transit status - my $transfer = $item->get_transfer; - if ( $transfer ) { - $item_info->{transfertwhen} = $transfer->datesent; - $item_info->{transfertfrom} = $transfer->frombranch; - $item_info->{transfertto} = $transfer->tobranch; - $item_info->{nocancel} = 1; + 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; } foreach my $f (qw( itemnotes )) { -- 2.39.5