Koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc
Owen Leonard b197d8bf90 Bug 9214 - Show damaged status in the OPAC for items which are not for loan
Item statuses in the OPAC displayed according to a cascading hierarchy:
If something is lost it will appear as lost, "else if" it is checked out
it will appear as checked out, etc. I don't think there is a logical
reason why statuses should appear this way.

This patch modifies the logic in the template so that multiple statuses
can be displayed at the same time. The patch also wraps each status in
its own class so that libraries can apply custom CSS if they wish.

Some tweaks have been made to the LESS file adding some style to the
common "item-status" class for display of item statuses.

To test, apply the patch and view one or more titles in the OPAC which
have items with the following statuses: lost, checked out, damaged, not
for loan, waiting, on order, in transit, withdrawn, and available.

Modify items to have more that one status simultaneously, in particular
not for loan and damaged.

Also test the display of item statuses in the OPAC cart and the OPAC's
course details page (Course reserves -> [Course name]) since these pages
use the same include file.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 15:13:03 -03:00

87 lines
3.4 KiB
HTML

[% 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.GetByCode( 'LOST', item.itemlost, 1 ) %]
[% IF ( av_lib_include ) %]
<span class="item-status lost">[% av_lib_include %]</span>
[% ELSE %]
[% IF ( item.lostimageurl ) %]
<img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]" />
[% ELSE %]
<span class="item-status lost">Item lost</span>
[% END %]
[% END %]
[% END %]
[% IF ( item.datedue || issue.date_due ) %]
[% SET itemavailable = 0 %]
[% IF item.onsite_checkout %]
[% IF ( OPACShowCheckoutName ) %]
<span class="item-status checkedout">Currently in local use by [% item.firstname %] [% item.surname %] [% IF ( item.cardnumber ) %]([% item.cardnumber %])[% 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 %] [% item.surname %] [% IF ( item.cardnumber ) %]([% item.cardnumber %])[% END %]</span>
[% ELSE %]
<span class="item-status checkedout">Checked out</span>
[% END %]
[% END %]
[% END %]
[% IF ( item.transfertwhen ) %]
[% SET itemavailable = 0 %]
<span class="item-status intransit">In transit from [% item.transfertfrom %]
to [% item.transfertto %] since [% item.transfertwhen | $KohaDates %]</span>
[% END %]
[% IF ( item.waiting ) %]
[% SET itemavailable = 0 %]
<span class="item-status onhold">On hold</span>
[% END %]
[% IF ( item.withdrawn ) %]
[% SET itemavailable = 0 %]
<span class="item-status withdrawn">Item withdrawn</span>
[% END %]
[% IF ( item.itemnotforloan ) %]
[% SET itemavailable = 0 %]
[% IF ( item.notforloanvalueopac ) %]
<span class="item-status notforloan">[% item.notforloanvalueopac %] [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
[% ELSE %]
<span class="item-status notforloan">Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
[% END %]
[% ELSIF ( item.notforloan_per_itemtype ) %]
[% SET itemavailable = 0 %]
<span class="item-status notforloan">Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
[% END %]
[% IF ( item.damaged ) %]
[% SET itemavailable = 0 %]
[% av_lib_include = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged, 1 ) %]
[% IF av_lib_include %]
<span class="item-status damaged">[% av_lib_include %]</span>
[% ELSE %]
<span class="item-status damaged">Item damaged</span>
[% END %]
[% END %]
[% IF item.on_order %]
[% SET itemavailable = 0 %]
<span class="item-status onorder">On order</span>
[% END %]
[% IF ( itemavailable ) %]
<span class="item-status available">Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
[% END %]