From 8f09ef75c365fd20dcdfefb92122e1b0c6afa6d6 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 2 Jun 2022 22:59:56 +0000 Subject: [PATCH] Bug 30886: Show pending recall on item on OPAC The 'completed' flag was causing the wrong status to be shown, but we can also give a more useful message to the patron. To test: 1) Enable the UseRecalls system preference and set up your recalls-related circulation rules. 2) Check out an item to Patron B. 3) Log into the OPAC as Patron A and search for the item. 4) Place a recall on that item. 5) Go back to the staff client and check the item in. Confirm the recall as waiting for Patron A. 6) Go back to the OPAC record page and look at the holdings table. Notice the status still says the item is Available. 7) Apply patch, restart services, refresh the OPAC. 8) Confirm the holdings table status now says the item has a pending recall. Sponsored-by: Catalyst IT Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../opac-tmpl/bootstrap/en/includes/item-status.inc | 5 +++++ opac/opac-detail.pl | 10 +++++----- 2 files changed, 10 insertions(+), 5 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 a0374c408b..7b5688c0e1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -96,6 +96,11 @@ Pending hold [% END %] +[% IF item.has_pending_recall %] + [% SET itemavailable = 0 %] + Pending recall +[% END %] + [% IF ( itemavailable ) %] [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %] Available [% IF restrictedvalueopac %]([% restrictedvalueopac | html %])[% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index b281c958f6..0d2fa672fe 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -731,18 +731,18 @@ if ( not $viewallitems and @items > $max_items_to_display ) { } my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); - my $recall_status; + if ( $reserve_status eq "Waiting" ) { $itm->{'waiting'} = 1; } + if ( $reserve_status eq "Reserved" ) { $itm->{'onhold'} = 1; } + if ( C4::Context->preference('UseRecalls') ) { - my $recall_status = Koha::Recalls->search( + my $pending_recall_count = Koha::Recalls->search( { item_id => $itm->{itemnumber}, status => 'waiting', - completed => undef, } )->count; + if ( $pending_recall_count ) { $itm->{has_pending_recall} = 1; } } - if ( $reserve_status eq "Waiting" or $recall_status ) { $itm->{'waiting'} = 1; } - if ( $reserve_status eq "Reserved" ) { $itm->{'onhold'} = 1; } my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); if ( defined( $transfertwhen ) && $transfertwhen ne '' ) { -- 2.39.5