Koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc
Aleisha Amohia 8f09ef75c3
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>
2022-06-06 11:30:14 -03:00

107 lines
4.9 KiB
HTML

[% USE Branches %]
[% USE AuthorisedValues %]
[% SET itemavailable = 1 %]
[%#- This include takes two parameters: an item structure -%]
[%#- and an optional loan (issue) structure. The issue -%]
[%#- structure is used by course reserves pages, which do -%]
[%#- not use an API to fetch items that populates item.datedue. -%]
[% IF ( item.itemlost ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %]
[% IF ( av_lib_include ) %]
<span class="item-status lost">[% av_lib_include | html %]</span>
[% ELSE %]
<span class="item-status lost">Item lost</span>
[% END %]
[% END %]
[% IF item.isa('Koha::Item') %]
[% SET datedue = issue.date_due %]
[% SET onsite_checkout = issue.onsite_checkout %]
[% ELSE %]
[% SET datedue = item.datedue || issue.date_due %]
[% SET onsite_checkout = item.onsite_checkout %]
[% END %]
[% IF datedue %]
[% SET itemavailable = 0 %]
[% IF onsite_checkout %]
[% IF ( OPACShowCheckoutName ) %]
<span class="item-status checkedout">Currently in local use by [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span>
[% ELSE %]
<span class="item-status checkedout">Currently in local use</span>
[% END %]
[% ELSE %]
[% IF ( OPACShowCheckoutName ) %]
<span class="item-status checkedout">Checked out to [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span>
[% ELSE %]
<span class="item-status checkedout">Checked out</span>
[% END %]
[% END %]
[% IF item.avail_for_recall %]<a href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% item.biblionumber | uri %]" class="btn btn-default btn-xs">Recall</a>[% END %]
[% END %]
[% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
[% SET itemavailable = 0 %]
<span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %]
to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span>
[% END %]
[% IF NOT( item.isa('Koha::Item') ) AND item.waiting %] [%# Not sure where does come from this waiting flag %]
[% SET itemavailable = 0 %]
<span class="item-status onhold">On hold</span>
[% END %]
[% IF ( item.withdrawn ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
[% IF av_lib_include %]
<span class="item-status withdrawn">[% av_lib_include | html %]</span>
[% ELSE %]
<span class="item-status withdrawn">Item withdrawn</span>
[% END %]
[% END %]
[% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %]
[% SET itemavailable = 0 %]
[% IF ( item.notforloanvalueopac ) %]
<span class="item-status notforloan">[% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
[% ELSE %]
<span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
[% END %]
[% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %]
[% SET itemavailable = 0 %]
<span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
[% END %]
[% IF ( item.damaged ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
[% IF av_lib_include %]
<span class="item-status damaged">[% av_lib_include | html %]</span>
[% ELSE %]
<span class="item-status damaged">Item damaged</span>
[% END %]
[% END %]
[% IF NOT ( item.isa('Koha::Item') ) AND item.on_order %][%# on_order is only set from opac-detail.pl %]
[% SET itemavailable = 0 %]
<span class="item-status onorder">On order</span>
[% END %]
[% IF item.has_pending_hold %]
[% SET itemavailable = 0 %]
<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>
[% END %]