From 60676a8fc395cb072d03a14ded4db59375e75b78 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 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 --- catalogue/detail.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 75aeed0e96..0d5a91e140 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 GetMarcBiblio ); use C4::Items qw( GetAnalyticsCount GetHostItemsInfo GetItemsInfo ); -use C4::Circulation qw( GetTransfers ); use C4::Reserves; use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); use C4::XISBN qw( get_xisbns ); @@ -42,7 +41,7 @@ use C4::External::Amazon qw( get_amazon_tld ); use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); use C4::Tags qw( get_tags ); use C4::XSLT qw( XSLTParse4Display ); -use Koha::DateUtils qw( format_sqldatetime ); +use Koha::DateUtils qw( format_sqldatetime output_pref ); use C4::HTML5Media; use C4::CourseReserves qw( GetItemCourseReservesInfo ); use Koha::AuthorisedValues; @@ -345,11 +344,11 @@ foreach my $item (@items) { } # Check the transit status - my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($item->{itemnumber}); - 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} = output_pref({ dt => dt_from_string($transfer->datesent) }); + $item->{transfertfrom} = $transfer->frombranch; + $item->{transfertto} = $transfer->tobranch; $item->{nocancel} = 1; } -- 2.20.1