From e023f838683f32f93516b33ce36780bd2669de12 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 7 Jul 2016 18:04:27 +0100 Subject: [PATCH] Bug 16686: Rename the transfer method to get_transfer Signed-off-by: Marc Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- Koha/Item.pm | 15 +++++++++++++-- .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 55bf14ec81..0bbc4933a0 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -23,6 +23,7 @@ use Carp; use Koha::Database; +use Koha::Item::Transfer; use Koha::Patrons; use Koha::Libraries; @@ -74,9 +75,19 @@ sub holding_branch { return $self->{_holding_branch}; } -sub transfer { +=head3 get_transfer + +my $transfer = $item->get_transfer; + +Return the transfer if the item is in transit or undef + +=cut + +sub get_transfer { my ( $self ) = @_; - return $self->_result->branchtransfers->first; + my $transfer_rs = $self->_result->branchtransfers->search({ datearrived => undef })->first; + return unless $transfer_rs; + return Koha::Item::Transfer->_new_from_dbic( $transfer_rs ); } =head3 last_returned_by diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index c26f78f3e1..942e73d3ad 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -625,8 +625,8 @@ Using this account is not recommended because some parts of Koha will not functi [% END %] [% ELSE %] [% IF ( RESERVE.is_in_transit ) %] - [% SET transfer = RESERVE.item.transfer %] - Item in transit from [% transfer.frombranch.branchname %] since + [% SET transfer = RESERVE.item.get_transfer %] + Item in transit from [% Branches.GetName( transfer.frombranch ) %] since [% transfer.datesent | $KohaDates %] [% ELSIF ( RESERVE.suspend ) %] Suspended [% IF ( RESERVE.suspend_until ) %] until [% RESERVE.suspend_until %] [% END %] -- 2.39.5