Bug 24295: Remove GetTransfers from opac-basket.pl

This patch replaces the call to GetTransfers in opac-basket with the
get_transfer method available from the Koha::Item object

Test plan
1/ Trigger the transfer of the item
2/ Check the opac-basket 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. Add missing
    Koha::Items module import.

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:09:42 +00:00 committed by Tomas Cohen Arazi
parent 245da0f198
commit e6334cc360
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 7 additions and 6 deletions

View File

@ -26,13 +26,13 @@ use C4::Biblio qw(
GetMarcSubjects
GetMarcUrls
);
use C4::Circulation qw( GetTransfers );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha::RecordProcessor;
use Koha::CsvProfiles;
use Koha::AuthorisedValues;
use Koha::Biblios;
use Koha::Items;
my $query = CGI->new;
@ -123,11 +123,12 @@ foreach my $biblionumber ( @bibs ) {
if ($itm->{'location'}){
$itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
}
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
$itm->{transfertwhen} = $transfertwhen;
$itm->{transfertfrom} = $transfertfrom;
$itm->{transfertto} = $transfertto;
my $item_object = Koha::Items->find($itm->{itemnumber});
my $transfer = $item_object->get_transfer;
if ( $transfer && $transfer->in_transit ) {
$itm->{transfertwhen} = $transfer->datesent;
$itm->{transfertfrom} = $transfer->frombranch;
$itm->{transfertto} = $transfer->tobranch;
}
}
$num++;