Skip to content

Commit e6334cc

Browse files
mrenvoizetomascohen
authored andcommitted
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>
1 parent 245da0f commit e6334cc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

opac/opac-basket.pl

+7-6
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
GetMarcSubjects
2727
GetMarcUrls
2828
);
29-
use C4::Circulation qw( GetTransfers );
3029
use C4::Auth qw( get_template_and_user );
3130
use C4::Output qw( output_html_with_http_headers );
3231
use Koha::RecordProcessor;
3332
use Koha::CsvProfiles;
3433
use Koha::AuthorisedValues;
3534
use Koha::Biblios;
35+
use Koha::Items;
3636

3737
my $query = CGI->new;
3838

@@ -123,11 +123,12 @@
123123
if ($itm->{'location'}){
124124
$itm->{'location_opac'} = $shelflocations->{$itm->{'location'} };
125125
}
126-
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
127-
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
128-
$itm->{transfertwhen} = $transfertwhen;
129-
$itm->{transfertfrom} = $transfertfrom;
130-
$itm->{transfertto} = $transfertto;
126+
my $item_object = Koha::Items->find($itm->{itemnumber});
127+
my $transfer = $item_object->get_transfer;
128+
if ( $transfer && $transfer->in_transit ) {
129+
$itm->{transfertwhen} = $transfer->datesent;
130+
$itm->{transfertfrom} = $transfer->frombranch;
131+
$itm->{transfertto} = $transfer->tobranch;
131132
}
132133
}
133134
$num++;

0 commit comments

Comments
 (0)