Bug 24295: Remove GetTransfers from opac-reserve.pl

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ä <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 15:56:20 +00:00 committed by Tomas Cohen Arazi
parent 7b31a35824
commit 245da0f198
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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;
}