From 702b975ad3daad070c4308938eb92a5c9211e6c0 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 --- Koha/Item.pm | 15 +++++++++++++-- koha-tmpl/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 55bf14e..0bbc493 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 83c1dbc..793e09a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -604,8 +604,8 @@ [% 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.8.1