Bug 28854: (follow-up) Link to 'In bundle' on OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / includes / item-status.inc
1 [% USE Branches %]
2 [% USE AuthorisedValues %]
3 [% SET itemavailable = 1 %]
4
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. -%]
9
10 [% IF ( item.itemlost ) %]
11     [% SET itemavailable = 0 %]
12     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost, opac => 1 ) %]
13     [% IF ( av_lib_include ) %]
14         <span class="item-status lost">[% av_lib_include | html %]</span>
15     [% ELSE %]
16         <span class="item-status lost">Item lost</span>
17     [% END %]
18 [% END %]
19
20 [% IF item.isa('Koha::Item') %]
21     [% SET datedue = issue.date_due %]
22     [% SET onsite_checkout = issue.onsite_checkout %]
23 [% ELSE %]
24     [% SET datedue = item.datedue || issue.date_due %]
25     [% SET onsite_checkout = item.onsite_checkout %]
26 [% END %]
27 [% IF datedue %]
28     [% SET itemavailable = 0 %]
29     [% IF onsite_checkout %]
30         [% IF ( OPACShowCheckoutName ) %]
31             <span class="item-status checkedout">Currently in local use by [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span>
32         [% ELSE %]
33             <span class="item-status checkedout">Currently in local use</span>
34         [% END %]
35     [% ELSE %]
36         [% IF ( OPACShowCheckoutName ) %]
37             <span class="item-status checkedout">Checked out to [% item.firstname | html %] [% item.surname | html %] [% IF ( item.cardnumber ) %]([% item.cardnumber | html %])[% END %]</span>
38         [% ELSE %]
39             <span class="item-status checkedout">Checked out</span>
40         [% END %]
41     [% END %]
42     [% 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 %]
43 [% END %]
44
45 [% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
46     [% SET itemavailable = 0 %]
47     <span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %]
48     to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span>
49 [% END %]
50
51 [% IF NOT( item.isa('Koha::Item') ) AND item.waiting %] [%# Not sure where does come from this waiting flag %]
52     [% SET itemavailable = 0 %]
53     <span class="item-status onhold">On hold</span>
54 [% END %]
55
56 [% IF ( item.withdrawn ) %]
57     [% SET itemavailable = 0 %]
58     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
59     [% IF av_lib_include %]
60         <span class="item-status withdrawn">[% av_lib_include | html %]</span>
61     [% ELSE %]
62         <span class="item-status withdrawn">Item withdrawn</span>
63     [% END %]
64 [% END %]
65
66
67 [% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %]
68     [% SET itemavailable = 0 %]
69     [% IF ( item.notforloanvalueopac ) %]
70         <span class="item-status notforloan">[% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
71     [% ELSE %]
72         <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
73     [% END %]
74 [% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %]
75     [% SET itemavailable = 0 %]
76     <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
77 [% END %]
78
79 [% IF ( item.bundle_host ) %]
80     <span class="bundled">In bundle: <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% item.bundle_host.biblionumber %]">[% INCLUDE 'biblio-title.inc' biblio = item.bundle_host.biblio %]</a></span>
81 [% END %]
82
83 [% IF ( item.damaged ) %]
84     [% SET itemavailable = 0 %]
85     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
86     [% IF av_lib_include %]
87         <span class="item-status damaged">[% av_lib_include | html %]</span>
88     [% ELSE %]
89         <span class="item-status damaged">Item damaged</span>
90     [% END %]
91 [% END %]
92
93 [% IF NOT ( item.isa('Koha::Item') ) AND item.on_order %][%# on_order is only set from opac-detail.pl %]
94     [% SET itemavailable = 0 %]
95     <span class="item-status onorder">On order</span>
96 [% END %]
97
98 [% IF item.has_pending_hold %]
99     [% SET itemavailable = 0 %]
100     <span class="item-status pendinghold">Pending hold</span>
101 [% END %]
102
103 [% IF item.has_pending_recall %]
104     [% SET itemavailable = 0 %]
105     <span class="item-status pendingrecall">Pending recall</span>
106 [% END %]
107
108 [% IF ( itemavailable ) %]
109     [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
110     <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
111 [% END %]