View | Details | Raw Unified | Return to bug 28762
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/item-status.inc (-60 / +57 lines)
Lines 1-72 Link Here
1
[% USE Branches %]
2
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
3
[% SET itemavailable = 1 %]
2
[% USE Branches %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
5
5
[%#- This include takes two parameters: an item structure -%]
6
[% SET itemavailable = 1 %]
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
7
10
[% IF ( item.itemlost ) %]
8
[% IF ( item.itemlost ) %]
11
    [% SET itemavailable = 0 %]
9
    [% SET itemavailable = 0 %]
12
    [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
10
    [% itemlost_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
13
    [% IF ( av_lib_include ) %]
11
    [% IF ( itemlost_description ) %]
14
        <span class="item-status lost">[% av_lib_include | html %]</span>
12
        <span class="item-status lost">[% itemlost_description | html %]</span>
15
    [% ELSE %]
13
    [% ELSE %]
16
        <span class="item-status lost">Item lost</span>
14
        <span class="item-status lost">Lost</span>
17
    [% END %]
15
    [% END %]
18
[% END %]
16
[% END %]
19
17
20
[% IF item.isa('Koha::Item') %]
18
[% checkout = item.checkout %]
21
    [% SET datedue = issue.date_due %]
19
[% IF ( checkout ) %]
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 %]
20
    [% SET itemavailable = 0 %]
29
    [% IF onsite_checkout %]
21
    [% IF checkout.onsite_checkout %]
30
        [% IF ( OPACShowCheckoutName ) %]
22
        <span class="item-status checkedout">Currently in local use by [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]</span>
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 %]
23
    [% ELSE %]
36
        [% IF ( OPACShowCheckoutName ) %]
24
        <span class="item-status checkedout">Checked out to [% INCLUDE 'patron-title.inc' patron=checkout.patron hide_patron_infos_if_needed=1 %]</span>
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 %]
25
    [% END %]
26
    <span class="item-status due">Due: [% checkout.date_due | $KohaDates %]</span>
42
[% END %]
27
[% END %]
43
28
44
[% IF NOT ( item.isa('Koha::Item') ) AND item.transfertwhen %] [%# transfertwhen is set in C4::Search, do not have it for course reserves %]
29
[% transfer = item.get_transfer %]
45
    [% SET itemavailable = 0 %]
30
[% IF ( transfer.in_transit ) %]
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 %]
31
    [% SET itemavailable = 0 %]
52
    <span class="item-status onhold">On hold</span>
32
    <span class="item-status intransit">In transit from [% Branches.GetName( transfer.frombranch ) | html %]
33
    to [% Branches.GetName( transfer.tobranch ) | html %] since [% transfer.datesent | $KohaDates %]</span>
53
[% END %]
34
[% END %]
54
35
55
[% IF ( item.withdrawn ) %]
36
[% IF ( item.withdrawn ) %]
56
    [% SET itemavailable = 0 %]
37
    [% SET itemavailable = 0 %]
57
    [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
38
    [% withdrawn_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => item.withdrawn ) %]
58
    [% IF av_lib_include %]
39
    [% IF withdrawn_description %]
59
        <span class="item-status withdrawn">[% av_lib_include | html %]</span>
40
        <span class="item-status withdrawn">[% withdrawn_description | html %]</span>
60
    [% ELSE %]
41
    [% ELSE %]
61
        <span class="item-status withdrawn">Item withdrawn</span>
42
        <span class="item-status withdrawn">Withdrawn</span>
62
    [% END %]
43
    [% END %]
63
[% END %]
44
[% END %]
64
45
65
[% IF ( item.notforloan ) %]
46
[% IF ( item.notforloan || item.effective_itemtype.notforloan ) %]
66
    [% SET itemavailable = 0 %]
47
    [% SET itemavailable = 0 %]
67
    [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
48
    [% SET notforloan = item.notforloan || item.effective_itemtype.notforloan %]
68
    [% IF av_lib_include %]
49
    [% notforloan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => notforloan ) %]
69
        <span class="item-status notforloan">[% av_lib_include | html %]</span>
50
    [% IF notforloan_description %]
51
        <span class="item-status notforloan">[% notforloan_description | html %]</span>
70
    [% ELSE %]
52
    [% ELSE %]
71
        <span class="item-status notforloan">Not for loan</span>
53
        <span class="item-status notforloan">Not for loan</span>
72
    [% END %]
54
    [% END %]
Lines 74-94 Link Here
74
56
75
[% IF ( item.damaged ) %]
57
[% IF ( item.damaged ) %]
76
    [% SET itemavailable = 0 %]
58
    [% SET itemavailable = 0 %]
77
    [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
59
    [% damaged_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => item.damaged ) %]
78
    [% IF av_lib_include %]
60
    [% IF damaged_description %]
79
        <span class="item-status damaged">[% av_lib_include | html %]</span>
61
        <span class="item-status damaged">[% damaged_description | html %]</span>
80
    [% ELSE %]
62
    [% ELSE %]
81
        <span class="item-status damaged">Item damaged</span>
63
        <span class="item-status damaged">Damaged</span>
82
    [% END %]
83
[% END %]
84
85
[% IF ( item.restricted ) %]
86
    [% SET itemavailable = 0 %]
87
    [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %]
88
    [% IF av_lib_include %]
89
        <span class="item-status restricted">[% av_lib_include | html %]</span>
90
    [% ELSE %]
91
        <span class="item-status restricted">On order</span>
92
    [% END %]
64
    [% END %]
93
[% END %]
65
[% END %]
94
66
Lines 97-102 Link Here
97
    <span class="item-status pendinghold">Pending hold</span>
69
    <span class="item-status pendinghold">Pending hold</span>
98
[% END %]
70
[% END %]
99
71
72
[% hold = item.holds.next %]
73
[% IF hold %]
74
        [% IF hold.waitingdate %]
75
            [% SET itemavailable = 0 %]
76
            <span class="item-status holdwaiting">Waiting at [% Branches.GetName(hold.get_column('branchcode')) | html %] since [% hold.waitingdate | $KohaDates %].</span>
77
        [% ELSE %]
78
            <span class="item-status itemhold">Item-level hold (placed [% hold.reservedate | $KohaDates %]) for delivery at [% Branches.GetName(hold.get_column('branchcode')) | html %].</span>
79
        [% END %]
80
        [% IF Koha.Preference('canreservefromotherbranches') %]
81
            <span class="item-status holdfor">Hold for: [% INCLUDE 'patron-title.inc' patron=hold.borrower hide_patron_infos_if_needed=1 %]</span>
82
        [% END %]
83
    </span>
84
[% END %]
85
100
[% IF ( itemavailable ) %]
86
[% IF ( itemavailable ) %]
101
    <span class="item-status available">Available</span>
87
    <span class="item-status available">Available</span>
102
[% END %]
88
[% END %]
103
- 
89
90
[% IF ( item.restricted ) %]
91
    [% restricted_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) %]
92
    [% IF restricted_description %]
93
        <span class="item-status restricted">[% restricted_description | html %]</span>
94
    [% ELSE %]
95
        <span class="item-status restricted">Restricted</span>
96
    [% END %]
97
[% END %]
98
99
100

Return to bug 28762