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

JK: Remove unneeded string formatting for transfertwhen as it's done
    on the template toolkit side already with $KohaDates

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>
This commit is contained in:
Martin Renvoize 2021-03-15 16:18:36 +00:00 committed by Tomas Cohen Arazi
parent 62512dc5d6
commit 8dab736b76
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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 )) {