3 [% USE AuthorisedValues %]
4 [% SET itemavailable = 1 %]
6 [%#- This include takes two parameters: an item structure -%]
7 [%#- and an optional loan (issue) structure. The issue -%]
8 [%#- structure is used by course reserves pages, which do -%]
9 [%#- not use an API to fetch items that populates item.datedue. -%]
11 [% UNLESS item.isa('Koha::Item') %]
12 <div>Programming error, item-status.inc must be called with a Koha::Item object.<div>
16 [% SET transfer = item.get_transfer %]
17 [% IF transfer AND transfer.in_transit %]
18 [% SET transfertwhen = transfer.datesent %]
19 [% SET transfertfrom = transfer.frombranch %]
20 [% SET transfertto = transfer.tobranch %]
23 [% SET checkout = item.checkout %]
24 [% SET waiting = item.holds.waiting.count %]
25 [% IF include_schema_org %]
26 [% IF item.damaged or checkout or item.itemlost or transfertwhen or waiting %]
27 <link property="availability" href="http://schema.org/OutOfStock" />
28 [% ELSIF item.withdrawn %]
29 <link property="availability" href="http://schema.org/Discontinued" />
30 [% ELSIF item.notforloan or item.itemtype.notforloan %]
31 <link property="availability" href="http://schema.org/InStoreOnly" />
33 <link property="availability" href="http://schema.org/InStock" />
37 [% IF ( item.itemlost ) %]
38 [% SET itemavailable = 0 %]
39 [% itemlost_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %]
41 <span class="item-status lost">[% itemlost_lib | html %]</span>
43 <span class="item-status lost">Item lost</span>
48 [% SET checkout_patron = checkout.patron %]
49 [% SET onsite_checkout = checkout.onsite_checkout %]
51 [% SET itemavailable = 0 %]
52 [% IF onsite_checkout %]
53 [% IF ( Koha.Preference('OPACShowCheckoutName') ) %]
54 <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>
56 <span class="item-status checkedout">Currently in local use</span>
59 [% IF ( Koha.Preference('OPACShowCheckoutName') ) %]
60 <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>
62 <span class="item-status checkedout">Checked out</span>
65 [% IF show_recall_link %]
66 [% IF logged_in_user.borrowernumber != issue.borrowernumber %]
67 <a href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% item.biblionumber | uri %]" class="btn btn-default btn-xs">Recall</a>
72 [% IF transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
73 [% SET itemavailable = 0 %]
74 <span class="item-status intransit">In transit from [% Branches.GetName( transfertfrom ) | html %]
75 to [% Branches.GetName( transfertto ) | html %] since [% transfertwhen | $KohaDates %]</span>
78 [% IF waiting OR item.holds.processing.count %]
79 [% SET itemavailable = 0 %]
80 <span class="item-status onhold">On hold</span>
83 [% IF ( item.withdrawn ) %]
84 [% SET itemavailable = 0 %]
85 [% withdrawn_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
86 [% IF withdrawn_lib %]
87 <span class="item-status withdrawn">[% withdrawn_lib | html %]</span>
89 <span class="item-status withdrawn">Item withdrawn</span>
94 [% SET restricted_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted, opac => 1 ) %]
95 [% IF item.notforloan %]
96 [% SET itemavailable = 0 %]
97 [% notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan, opac => 1 ) %]
98 [% IF notforloan_lib %]
99 <span class="item-status notforloan">[% notforloan_lib | html %] [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
101 <span class="item-status notforloan">Not for loan [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
103 [% ELSIF item.itemtype.notforloan %]
104 [% SET itemavailable = 0 %]
105 <span class="item-status notforloan">Not for loan [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>
107 [% IF restricted_lib %]
108 <span class="item-status restricted">[% restricted_lib | html %]</span>
112 [% IF ( item.bundle_host ) %]
113 <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>
116 [% IF ( item.damaged ) %]
117 [% SET itemavailable = 0 %]
118 [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
119 [% IF av_lib_include %]
120 <span class="item-status damaged">[% av_lib_include | html %]</span>
122 <span class="item-status damaged">Item damaged</span>
126 [% IF Koha.Preference('OPACAcquisitionDetails') AND item.orders.filter_by_active.count %]
127 [% SET itemavailable = 0 %]
128 <span class="item-status onorder">On order</span>
131 [% IF item.has_pending_hold %]
132 [% SET itemavailable = 0 %]
133 <span class="item-status pendinghold">Pending hold</span>
136 [% IF Koha.Preference('UseRecalls') && item.has_pending_recall %]
137 [% SET itemavailable = 0 %]
138 <span class="item-status pendingrecall">Pending recall</span>
141 [% IF ( itemavailable ) %]
142 <span class="item-status available">Available [% IF restricted_lib %]<span class="restricted">([% restricted_lib | html %])</span>[% END %]</span>