2 [% USE AuthorisedValues %]
3 [% SET itemavailable = 1 %]
5 [%#- This include takes two parameters: an item structure -%]
6 [%#- and an optional loan (issue) structure. The issue -%]
7 [%#- structure is used by course reserves pages, which do -%]
8 [%#- not use an API to fetch items that populates item.datedue. -%]
10 [% UNLESS item.isa('Koha::Item') %]
11 <div>Programming error, item-status.inc must be called with a Koha::Item object.<div>
15 [% SET transfer = item.get_transfer %]
16 [% IF transfer AND transfer.in_transit %]
17 [% SET transfertwhen = transfer.datesent %]
18 [% SET transfertfrom = transfer.frombranch %]
19 [% SET transfertto = transfer.tobranch %]
22 [% SET checkout = item.checkout %]
23 [% SET waiting = item.holds.waiting.count %]
24 [% IF include_schema_org %]
25 [% IF item.damaged or checkout or item.itemlost or transfertwhen or waiting %]
26 <link property="availability" href="http://schema.org/OutOfStock" />
27 [% ELSIF item.withdrawn %]
28 <link property="availability" href="http://schema.org/Discontinued" />
29 [% ELSIF item.notforloan or item.itemtype.notforloan %]
30 <link property="availability" href="http://schema.org/InStoreOnly" />
32 <link property="availability" href="http://schema.org/InStock" />
36 [% IF ( item.itemlost ) %]
37 [% SET itemavailable = 0 %]
38 [% itemlost_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %]
40 <span class="item-status lost">[% itemlost_lib | html %]</span>
42 <span class="item-status lost">Item lost</span>
47 [% SET checkout_patron = checkout.patron %]
48 [% SET onsite_checkout = checkout.onsite_checkout %]
50 [% SET itemavailable = 0 %]
51 [% IF onsite_checkout %]
52 [% IF ( OPACShowCheckoutName ) %]
53 <span class="item-status checkedout">Currently in local use by [% checkout_patron.firstname | html %] [% checkout_patron.surname | html %] [% IF ( checkout_patron.cardnumber ) %]([% checkout_patron.cardnumber | html %])[% END %]</span>
55 <span class="item-status checkedout">Currently in local use</span>
58 [% IF ( OPACShowCheckoutName ) %]
59 <span class="item-status checkedout">Checked out to [% checkout_patron.firstname | html %] [% checkout_patron.surname | html %] [% IF ( checkout_patron.cardnumber ) %]([% checkout_patron.cardnumber | html %])[% END %]</span>
61 <span class="item-status checkedout">Checked out</span>
64 [% IF show_recall_link %]
65 [% IF logged_in_user.borrowernumber != issue.borrowernumber %]
66 <a href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% item.biblionumber | uri %]" class="btn btn-default btn-xs">Recall</a>
71 [% IF transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
72 [% SET itemavailable = 0 %]
73 <span class="item-status intransit">In transit from [% Branches.GetName( transfertfrom ) | html %]
74 to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %]</span>
77 [% IF waiting OR item.holds.processing.count %]
78 [% SET itemavailable = 0 %]
79 <span class="item-status onhold">On hold</span>
82 [% IF ( item.withdrawn ) %]
83 [% SET itemavailable = 0 %]
84 [% withdrawn_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
85 [% IF withdrawn_lib %]
86 <span class="item-status withdrawn">[% withdrawn_lib | html %]</span>
88 <span class="item-status withdrawn">Item withdrawn</span>
93 [% SET restricted_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
94 [% IF item.notforloan %]
95 [% SET itemavailable = 0 %]
96 [% notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
97 [% IF notforloan_lib %]
98 <span class="item-status notforloan">[% notforloan_lib | html %] [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
100 <span class="item-status notforloan">Not for loan [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
102 [% ELSIF item.itemtype.notforloan %]
103 [% SET itemavailable = 0 %]
104 <span class="item-status notforloan">Not for loan [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
107 [% IF ( item.bundle_host ) %]
108 <span class="bundled">In bundle: <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% item.bundle_host.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio %]</a></span>
111 [% IF ( item.damaged ) %]
112 [% SET itemavailable = 0 %]
113 [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
114 [% IF av_lib_include %]
115 <span class="item-status damaged">[% av_lib_include | html %]</span>
117 <span class="item-status damaged">Item damaged</span>
121 [% IF Koha.Preference('OPACAcquisitionDetails') AND item.orders.filter_by_active.count %]
122 [% SET itemavailable = 0 %]
123 <span class="item-status onorder">On order</span>
126 [% IF item.has_pending_hold %]
127 [% SET itemavailable = 0 %]
128 <span class="item-status pendinghold">Pending hold</span>
131 [% IF Koha.Preference('UseRecalls') && item.has_pending_recall %]
132 [% SET itemavailable = 0 %]
133 <span class="item-status pendingrecall">Pending recall</span>
136 [% IF ( itemavailable ) %]
137 <span class="item-status available">Available [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>