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 <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 8f09ef75c3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Aleisha Amohia 2022-06-02 22:59:56 +00:00 committed by Lucas Gass
parent 38396f9dc3
commit 8bcba5be88
2 changed files with 10 additions and 5 deletions

View file

@ -96,6 +96,11 @@
<span class="item-status pendinghold">Pending hold</span>
[% END %]
[% IF item.has_pending_recall %]
[% SET itemavailable = 0 %]
<span class="item-status pendingrecall">Pending recall</span>
[% END %]
[% IF ( itemavailable ) %]
[% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
<span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>

View file

@ -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 '' ) {