Bug 27090: Opac basket: fix the 'In transit from' and 'to'
[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 [% END %]
43
44 [% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
45     [% SET itemavailable = 0 %]
46     <span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %]
47     to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span>
48 [% END %]
49
50 [% IF NOT( item.isa('Koha::Item') ) AND item.waiting %] [%# Not sure where does come from this waiting flag %]
51     [% SET itemavailable = 0 %]
52     <span class="item-status onhold">On hold</span>
53 [% END %]
54
55 [% IF ( item.withdrawn ) %]
56     [% SET itemavailable = 0 %]
57     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn, opac => 1 ) %]
58     [% IF av_lib_include %]
59         <span class="item-status withdrawn">[% av_lib_include | html %]</span>
60     [% ELSE %]
61         <span class="item-status withdrawn">Item withdrawn</span>
62     [% END %]
63 [% END %]
64
65
66 [% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %]
67     [% SET itemavailable = 0 %]
68     [% IF ( item.notforloanvalueopac ) %]
69         <span class="item-status notforloan">[% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
70     [% ELSE %]
71         <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
72     [% END %]
73 [% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %]
74     [% SET itemavailable = 0 %]
75     <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
76 [% END %]
77
78 [% IF ( item.damaged ) %]
79     [% SET itemavailable = 0 %]
80     [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged, opac => 1 ) %]
81     [% IF av_lib_include %]
82         <span class="item-status damaged">[% av_lib_include | html %]</span>
83     [% ELSE %]
84         <span class="item-status damaged">Item damaged</span>
85     [% END %]
86 [% END %]
87
88 [% IF NOT ( item.isa('Koha::Item') ) AND item.on_order %][%# on_order is only set from opac-detail.pl %]
89     [% SET itemavailable = 0 %]
90     <span class="item-status onorder">On order</span>
91 [% END %]
92
93 [% IF item.has_pending_hold %]
94     [% SET itemavailable = 0 %]
95     <span class="item-status pendinghold">Pending hold</span>
96 [% END %]
97
98 [% IF ( itemavailable ) %]
99     [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
100     <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
101 [% END %]