Bug 24295: Remove GetTransfers from svc/holds

This patch replaces the call to C4::GetTransfers in svc/holds with a
call to the get_transfer method in the Koha::Item object.

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:24:03 +00:00 committed by Tomas Cohen Arazi
parent 8dab736b76
commit 3c6fb4edda
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -24,7 +24,6 @@ use JSON qw(to_json);
use C4::Auth qw(check_cookie_auth);
use C4::Charset;
use C4::Circulation qw(GetTransfers);
use C4::Context;
use Koha::DateUtils qw( dt_from_string output_pref );
@ -139,13 +138,12 @@ while ( my $h = $holds_rs->next() ) {
$hold->{enumchron} = $item->enumchron();
$hold->{itemcallnumber} = $item->itemcallnumber() || q{};
my ( $transferred_when, $transferred_from, $transferred_to ) =
GetTransfers( $item->itemnumber() );
if ($transferred_when) {
my $transfer = $item->get_transfer;
if ( $transfer && $transfer->in_transit ) {
$hold->{color} = 'transferred';
$hold->{transferred} = 1;
$hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
$hold->{from_branch} = Koha::Libraries->find($transferred_from)->branchname;
$hold->{date_sent} = output_pref({ dt => dt_from_string($transfer->datesent) });
$hold->{from_branch} = Koha::Libraries->find($transfer->frombranch)->branchname;
}
elsif ( $item->holding_branch() && $item->holding_branch()->branchcode() ne
$h->branch()->branchcode() )