Bug 30886: Show pending recall on item 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.damaged ) %]
80     [% SET itemavailable = 0 %]
81     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
82     [% IF av_lib_include %]
83         <span class="item-status damaged">[% av_lib_include | html %]</span>
84     [% ELSE %]
85         <span class="item-status damaged">Item damaged</span>
86     [% END %]
87 [% END %]
88
89 [% IF NOT ( item.isa('Koha::Item') ) AND item.on_order %][%# on_order is only set from opac-detail.pl %]
90     [% SET itemavailable = 0 %]
91     <span class="item-status onorder">On order</span>
92 [% END %]
93
94 [% IF item.has_pending_hold %]
95     [% SET itemavailable = 0 %]
96     <span class="item-status pendinghold">Pending hold</span>
97 [% END %]
98
99 [% IF item.has_pending_recall %]
100     [% SET itemavailable = 0 %]
101     <span class="item-status pendingrecall">Pending recall</span>
102 [% END %]
103
104 [% IF ( itemavailable ) %]
105     [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
106     <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
107 [% END %]