From d1601e9f52554b76af9fbf0f5b9e2567a1581517 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 30 Sep 2022 12:01:36 +0000 Subject: [PATCH] Bug 31664: Display pending transfer information on details page If a transfer is requested, but not sent, we should display this information on biblio details for staff This patch also removes nocancel parameter that was not used, passes transfer object directly to template To test 1 - Manually transfer an item 2 - Note the item shows in transit on details page 3 - Remove the datesent to emulate a pending transfer UPDATE branchtransfers SET datesent = NULL itemnumber=1; 4 - View details page - no info on transfer 5 - Apply patch 6 - Item shows 'Transit pending' --- catalogue/detail.pl | 7 ++----- .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 11 ++++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 3af82774ce..5cb556ae05 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -402,11 +402,8 @@ foreach my $item (@items) { # Check the transit status my $transfer = $item->get_transfer; - if ( $transfer && $transfer->in_transit ) { - $item_info->{transfertwhen} = $transfer->datesent; - $item_info->{transfertfrom} = $transfer->frombranch; - $item_info->{transfertto} = $transfer->tobranch; - $item_info->{nocancel} = 1; + if ( $transfer ) { + $item_info->{transfer} = $transfer; } foreach my $f (qw( itemnotes )) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index f48413a010..339381f8e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -470,8 +470,13 @@ Note that permanent location is a code, and location may be an authval. [% END %] : due [% item.checkout.date_due | $KohaDates as_due_date => 1 %] - [% ELSIF ( item.transfertwhen ) %] - In transit from [% Branches.GetName( item.transfertfrom ) | html %] to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %] + [% ELSIF ( item.transfer ) %] + [% IF (item.transfer.datesent) %] + In transit from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.datesent | $KohaDates %] + [% ELSE %] + Transit pending from [% Branches.GetName( item.transfer.frombranch ) | html %] to [% Branches.GetName( item.transfer.tobranch ) | html %] since [% item.transfer.daterequested | $KohaDates %] + + [% END %] [% END %] [% IF ( item.itemlost ) %] @@ -542,7 +547,7 @@ Note that permanent location is a code, and location may be an authval. [% END %] [% END %] - [% UNLESS ( item.itemnotforloan || item.notforloan_per_itemtype || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfertwhen || hold || ( Koha.Preference('UseRecalls') && recall ) ) %] + [% UNLESS ( item.itemnotforloan || item.notforloan_per_itemtype || item.onloan || item.itemlost || item.withdrawn || item.damaged || item.transfer || hold || ( Koha.Preference('UseRecalls') && recall ) ) %] Available [% END %] -- 2.30.2