Bug 28805: (follow-up) Fix template logic error
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / readingrec.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Koha %]
5 [% USE AuthorisedValues %]
6 [% USE Branches %]
7 [% USE TablesSettings %]
8 [% PROCESS 'i18n.inc' %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>[% FILTER collapse %]
12     [% t("Circulation history for") | html %] [% INCLUDE 'patron-title.inc' no_html = 1 %]
13     [% t("Patrons") | html %] &rsaquo;
14     [% t("Koha") | html %]
15 [% END %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 </head>
18
19 <body id="pat_readingrec" class="pat">
20 [% WRAPPER 'header.inc' %]
21     [% INCLUDE 'patron-search-header.inc' %]
22 [% END %]
23
24 [% WRAPPER 'sub-header.inc' %]
25     [% WRAPPER breadcrumbs %]
26         [% WRAPPER breadcrumb_item %]
27             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
28         [% END %]
29         [% WRAPPER breadcrumb_item %]
30             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
31         [% END %]
32         [% WRAPPER breadcrumb_item bc_active= 1 %]
33             <span>Circulation history</span>
34         [% END %]
35     [% END #/ WRAPPER breadcrumbs %]
36 [% END #/ WRAPPER sub-header.inc %]
37
38 <div class="main container-fluid">
39     <div class="row">
40         <div class="col-sm-10 col-sm-push-2">
41             <main>
42
43 [% INCLUDE 'members-toolbar.inc' %]
44 <h1>Circulation history</h1>
45
46 [% SET all_checkouts = checkouts.merge(old_checkouts) %]
47 [% UNLESS Koha.Preference('intranetreadinghistory') %]
48     <div class="dialog alert">Staff members are not allowed to access patron's checkout history</div>
49 [% ELSIF is_anonymous %]
50     <div class="dialog alert">This is the anonymous patron, so no circulation history is displayed. To get a list of anonymized loans, please run a report.</div>
51 [% ELSIF ( patron.privacy == 2)  %]
52     <div class="dialog message">This patron has set the privacy rules to never keeping a circulation history.</div>
53 [% ELSIF ( !all_checkouts.size ) %]
54     <div class="dialog message">This patron has no circulation history.</div>
55 [% ELSE %]
56     <form action="/cgi-bin/koha/members/readingrec.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
57
58         [% BLOCK table_readingrec %]
59             <table id="table_readingrec">
60                 <thead>
61                     <tr>
62                         <th style="display:none;">Type</th>
63                         <th>Date</th>
64                         <th class="anti-the">Title</th>
65                         <th>Author</th>
66                         <th>Call number</th>
67                         <th>Vol info</th>
68                         <th>Barcode</th>
69                         <th>Number of renewals</th>
70                         <th>Checked out on</th>
71                         <th>Checked out from</th>
72                         [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
73                             <th>Checked out by</th>
74                         [% END %]
75                         <th>Date due</th>
76                         <th>Return date</th>
77                     </tr>
78                 </thead>
79                 <tbody>
80                     [% FOREACH checkout IN all_checkouts %]
81                         [% SET item = checkout.item %]
82                         [% SET biblio = item.biblio %]
83                         [% IF checkout.returndate %]<tr>[% ELSE %]<tr class="onissue">[% END %]
84                             <td style="display:none;">
85                                 [% IF checkout.onsite_checkout %][% issuetype = 'onsite_checkout' | html %]
86                                 [% ELSE %][% issuetype = 'standard_checkout' | html %]
87                                 [% END %]
88                                 [% issuetype | html %]
89                             </td>
90                             <td data-order="[% checkout.timestamp | html %]">
91                                 [% checkout.timestamp | $KohaDates with_hours => 1 %]
92                             </td>
93                             <td>
94                                 [% INCLUDE 'biblio-title.inc' biblio=biblio link = 1 %]
95                             </td>
96
97                             <td>[% biblio.author | html %]</td>
98
99                             <td>
100                                 [% item.itemcallnumber | html %]
101                             </td>
102
103                             <td>
104                                 [% IF item.enumchron %]
105                                     [% item.enumchron | html %]
106                                 [% END %]
107                             </td>
108
109                             <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% item.itemnumber | uri %]&amp;biblionumber=[% biblio.biblionumber | uri %]&amp;bi=[% item.biblioitemnumber | uri %]#item[% item.itemnumber | uri %]">[% item.barcode | html %]</a></td>
110                             <td>
111                                 [% checkout.renewals_count | html %]
112                                 [% IF checkout.renewals_count > 0 %]
113                                     [ <a class="checkout_renewals_view" data-renewals="[% checkout.renewals_count | html %]" data-issueid="[% checkout.issue_id | html %]" href="#">View</a> ]
114                                 [% END %]
115                             </td>
116                             <td data-order="[% checkout.issuedate | html %]">
117                                 [% checkout.issuedate | $KohaDates with_hours => 1 %]
118                             </td>
119                             <td>[% Branches.GetName( checkout.branchcode ) | html %]</td>
120                             [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
121                                 [% SET issuer = checkout.issuer %]
122                                 <td><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% issuer.issuer_id | uri %]">[% issuer.firstname | html %] [% issuer.surname | html %]</a></td>
123                             [% END %]
124                             <td data-order="[% checkout.date_due | html %]">
125                                 [% checkout.date_due | $KohaDates as_due_date => 1 %]
126                             </td>
127                             [% IF checkout.returndate %]
128                                 <td data-order="[% checkout.returndate | html %]">
129                                 [% checkout.returndate | $KohaDates with_hours => 1 %]
130                             [% ELSE %]
131                                 <td data-order="checked out">
132                                 <small>Checked out</small>
133                             [% END %]
134                             </td>
135                         </tr>
136                     [% END %]
137                 </tbody>
138             </table>
139         [% END %]
140
141         [% IF Koha.Preference('OnSiteCheckouts') %]
142             [% WRAPPER tabs id= "tabs" %]
143                 [% WRAPPER tabs_nav %]
144                     [% WRAPPER tab_item tabname= "tab_all" bt_active= 1 %] <span>All</span> [% END %]
145                     [% WRAPPER tab_item tabname= "tab_checkout" %] <span>Checkouts</span> [% END %]
146                     [% WRAPPER tab_item tabname= "tab_onsite_checkout" %] <span>On-site checkouts</span> [% END %]
147                 [% END # /WRAPPER tabs_nav %]
148                 [% WRAPPER tab_panels %]
149                     [% WRAPPER tab_panel tabname="readingrec" bt_active= 1 %]
150                         [% INCLUDE table_readingrec %]
151                     [% END # /tab_panel# %]
152                 [% END # /WRAPPER tab_panels %]
153             [% END # /WRAPPER tabs %]
154         [% ELSE %]
155             <div class="page-section">
156                 [% INCLUDE table_readingrec %]
157             </div> <!-- /.page-section -->
158         [% END # /IF Koha.Preference('OnSiteCheckouts') %]
159 [% END %]
160
161             </main>
162         </div> <!-- /.col-sm-10.col-sm-push-2 -->
163
164         <div class="col-sm-2 col-sm-pull-10">
165             <aside>
166                 [% INCLUDE 'circ-menu.inc' %]
167             </aside>
168         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
169      </div> <!-- /.row -->
170
171 [% MACRO jsinclude BLOCK %]
172     [% INCLUDE 'str/members-menu.inc' %]
173     [% Asset.js("js/members-menu.js") | $raw %]
174     [% INCLUDE 'datatables.inc' %]
175     [% INCLUDE 'columns_settings.inc' %]
176     [% INCLUDE 'modals/checkout_renewals.inc' %]
177     [% INCLUDE 'js-date-format.inc' %]
178     [% INCLUDE 'js-patron-format.inc' %]
179     [% Asset.js("js/checkout_renewals_modal.js") | $raw %]
180     <script id="js">
181         $(document).ready(function() {
182             [% IF Koha.Preference('RecordStaffUserOnCheckout') %]
183                 var column_sort = 11;
184             [% ELSE %]
185                 var column_sort = 10;
186             [% END %]
187             var table_settings = [% TablesSettings.GetTableSettings('members', 'checkouthistory', 'checkouthistory-table', 'json') | $raw %];
188             var table = KohaTable("table_readingrec", {
189                 "sPaginationType": "full",
190                 "aaSorting": [[column_sort, 'desc']]
191             }, table_settings);
192
193             $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
194                 active_tab = $(this).attr("href");
195                 if( active_tab == "#tab_checkout_panel" ){
196                     table.fnFilter("standard_checkout", 0);
197                 } else if( active_tab == "#tab_onsite_checkout_panel" ){
198                     table.fnFilter("onsite_checkout", 0);
199                 } else {
200                     table.fnFilter('', 0);
201                 }
202             });
203         });
204     </script>
205 [% END %]
206
207 [% INCLUDE 'intranet-bottom.inc' %]