From d1dd80e3adb56738449ef71dad744ecf9e4e5289 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 23 Aug 2022 19:51:32 +0000 Subject: [PATCH] Bug 31313: (QA follow-up) Show transfer status correctly if item in transit MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The patch "Bug 31313: Fix availability - OPAC opac-detail" (70cb4e22c07) caused the OPAC detail page only show "Available" status even when the item was in transit. Signed-off-by: Joonas Kylmälä Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../bootstrap/en/includes/item-status.inc | 18 +++++++++++++++--- opac/opac-detail.pl | 9 --------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 31bd552e54..4c179ca0dd 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -43,10 +43,22 @@ [% IF !item.isa('Koha::Item') AND item.avail_for_recall %]Recall[% END %] [% END %] -[% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %] +[% IF item.isa('Koha::Item') %] + [% SET transfer = item.get_transfer %] + [% IF transfer AND transfer.in_transit %] + [% SET transfertwhen = transfer.datesent %] + [% SET transfertfrom = transfer.frombranch %] + [% SET transfertto = transfer.tobranch %] + [% END %] +[% ELSE %] + [% SET transfertwhen = item.transfertwhen %] + [% SET transfertfrom = item.transfertfrom %] + [% SET transfertto = item.transfertto %] +[% END %] +[% IF transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %] [% SET itemavailable = 0 %] - In transit from [% Branches.GetName( item.transfertfrom ) | html %] - to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %] + In transit from [% Branches.GetName( transfertfrom ) | html %] + to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %] [% END %] [% IF (item.isa('Koha::Item') AND item.holds.waiting.count) OR (NOT item.isa('Koha::Item') AND item.waiting) %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 2f8a027078..ed224e08fb 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -45,7 +45,6 @@ use C4::Biblio qw( GetMarcSubjects GetMarcUrls ); -use C4::Circulation qw( GetTransfers ); use C4::Tags qw( get_tags ); use C4::XISBN qw( get_xisbns ); use C4::External::Amazon qw( get_amazon_tld ); @@ -729,14 +728,6 @@ else { $item_info->{checkout} = $item->checkout; $item_info->{object} = $item; - my ( $transfertwhen, $transfertfrom, $transfertto ) = - GetTransfers( $item->itemnumber ); - if ( defined($transfertwhen) && $transfertwhen ne '' ) { - $item_info->{transfertwhen} = $transfertwhen; - $item_info->{transfertfrom} = $transfertfrom; - $item_info->{transfertto} = $transfertto; - } - if ( C4::Context->preference('OPACAcquisitionDetails') ) { $item_info->{on_order} = 1 if grep { $_ eq $item->itemnumber } @itemnumbers_on_order; -- 2.39.5