Lines 45-119
Link Here
|
45 |
[% SET show_patron_column = Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %] |
45 |
[% SET show_patron_column = Koha.Preference('intranetreadinghistory') AND CAN_user_circulate_circulate_remaining_permissions %] |
46 |
|
46 |
|
47 |
<div class="searchresults"> |
47 |
<div class="searchresults"> |
48 |
[% IF checkouts %] |
48 |
[% IF current_checkouts_count + past_checkouts_count > 0 %] |
49 |
<h4>Checked out [% checkouts.size | html %] times</h4> |
49 |
<h3>Checked out [% current_checkouts_count + past_checkouts_count | html %] times</h3> |
50 |
<table id="table_issues"> |
50 |
|
51 |
<thead><tr> |
51 |
<h4>Current checkouts</h4> |
52 |
[% IF show_patron_column %] |
52 |
[% IF current_checkouts_count > 0 %] |
|
|
53 |
<table id="current_checkouts"> |
54 |
<thead><tr> |
55 |
[% IF show_patron_column %] |
53 |
<th>Patron</th> |
56 |
<th>Patron</th> |
54 |
[% END %] |
57 |
[% END %] |
55 |
<th>Barcode</th> |
58 |
<th>Barcode</th> |
56 |
<th>Checked out from</th> |
59 |
<th>Checked out from</th> |
57 |
[% IF Koha.Preference('RecordStaffUserOnCheckout') %] |
60 |
[% IF Koha.Preference('RecordStaffUserOnCheckout') %] |
58 |
<th>Checked out by</th> |
61 |
<th>Checked out by</th> |
59 |
[% ELSE %] |
62 |
[% ELSE %] |
60 |
<th class="NoVisible">Checked out by</th> |
63 |
<th class="NoVisible">Checked out by</th> |
61 |
[% END %] |
64 |
[% END %] |
62 |
<th>Renewed</th> |
65 |
<th>Renewed</th> |
63 |
<th>Checkout on</th> |
66 |
<th>Checkout on</th> |
64 |
<th>Due date</th> |
67 |
<th>Due date</th> |
65 |
<th>Checkin on</th> |
68 |
</tr></thead> |
66 |
</tr></thead> |
69 |
</table> |
67 |
<tbody> |
70 |
[% ELSE %] |
68 |
[% FOREACH checkout IN checkouts %] |
71 |
<div class="dialog message"> |
69 |
<tr> |
72 |
<p>Not currently checked out.</p> |
70 |
[% IF show_patron_column %] |
73 |
</div> |
71 |
<td> |
74 |
[% END %] |
72 |
[% IF checkout.patron %][%# Not set for deleted patron records %] |
75 |
|
73 |
[% INCLUDE 'patron-title.inc' patron => checkout.patron hide_patron_infos_if_needed=1 %] |
76 |
<h4>Past checkouts</h4> |
74 |
[% END %] |
77 |
|
75 |
</td> |
78 |
[% IF past_checkouts_count > 0 %] |
76 |
[% END %] |
79 |
<table id="old_checkouts"> |
77 |
<td> |
80 |
<thead><tr> |
78 |
[% IF checkout.item.barcode %] [%# FIXME This test is not mandatory I think %] |
81 |
[% IF show_patron_column %] |
79 |
<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% checkout.item.biblionumber | uri %]&itemnumber=[% checkout.item.itemnumber | uri %]">[% checkout.item.barcode | html %]</a> |
82 |
<th>Patron</th> |
80 |
[% ELSE %] |
|
|
81 |
|
82 |
[% END %]</td> |
83 |
<td>[% IF checkout.branchcode %] |
84 |
[% Branches.GetName( checkout.branchcode ) | html %] |
85 |
[% ELSE %] |
86 |
|
87 |
[% END %]</td> |
88 |
<td>[% IF checkout.issuer_id %] |
89 |
<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% checkout.issuer_id | uri %]"> |
90 |
[% INCLUDE 'patron-title.inc' patron=checkout.issuer %] |
91 |
</a> |
92 |
[% END %]</td> |
93 |
<td>[% IF checkout.renewals %] |
94 |
Yes[% IF checkout.lastreneweddate %], <small>last on: [% checkout.lastreneweddate |$KohaDates with_hours => 1 %]</small> |
95 |
[% END %] |
96 |
[% ELSE %] |
97 |
No |
98 |
[% END %]</td> |
99 |
<td data-order="[% checkout.issuedate | html %]"> |
100 |
[% checkout.issuedate |$KohaDates with_hours => 1 %] |
101 |
</td> |
102 |
<td data-order="[% checkout.date_due | html %]"> |
103 |
[% checkout.date_due |$KohaDates with_hours => 1 %] |
104 |
</td> |
105 |
<td data-order="[% checkout.returndate | html %]"> |
106 |
[% checkout.returndate |$KohaDates with_hours => 1 %] |
107 |
</td> |
108 |
</tr> |
109 |
[% END %] |
83 |
[% END %] |
110 |
</tbody> |
84 |
<th>Barcode</th> |
111 |
</table> |
85 |
<th>Checked out from</th> |
112 |
[% ELSE %] |
86 |
[% IF Koha.Preference('RecordStaffUserOnCheckout') %] |
113 |
<div class="dialog message"><p> |
87 |
<th>Checked out by</th> |
114 |
<strong>[% biblio.title | html %][% IF biblio.author %], by [% biblio.author | html %][% END %]</strong> has never been checked out.</p></div> |
88 |
[% ELSE %] |
|
|
89 |
<th class="NoVisible">Checked out by</th> |
90 |
[% END %] |
91 |
<th>Renewed</th> |
92 |
<th>Checkout on</th> |
93 |
<th>Due date</th> |
94 |
<th>Checkin on</th> |
95 |
</tr></thead> |
96 |
</table> |
97 |
[% ELSE %] |
98 |
<div class="dialog message"> |
99 |
<p>No past checkouts.</p> |
100 |
</div> |
101 |
[% END %] |
115 |
|
102 |
|
116 |
[% END %] |
103 |
[% ELSE %] |
|
|
104 |
<div class="dialog message"> |
105 |
<p> |
106 |
<strong>[% biblio.title | html %][% IF biblio.author %], by [% biblio.author | html %][% END %]</strong> has never been checked out. |
107 |
</p> |
108 |
</div> |
109 |
[% END %] |
117 |
</div> |
110 |
</div> |
118 |
|
111 |
|
119 |
</main> |
112 |
</main> |
Lines 129-146
Link Here
|
129 |
[% MACRO jsinclude BLOCK %] |
122 |
[% MACRO jsinclude BLOCK %] |
130 |
[% INCLUDE 'datatables.inc' %] |
123 |
[% INCLUDE 'datatables.inc' %] |
131 |
[% INCLUDE 'columns_settings.inc' %] |
124 |
[% INCLUDE 'columns_settings.inc' %] |
|
|
125 |
[% INCLUDE 'js-date-format.inc' %] |
126 |
[% INCLUDE 'js-patron-format.inc' %] |
132 |
<script id="js"> |
127 |
<script id="js"> |
133 |
$(document).ready(function() { |
128 |
$(document).ready(function() { |
|
|
129 |
|
130 |
function initialize_checkouts_table( table_selector, default_sort_column, checked_in, columns_settings ) { |
131 |
|
132 |
var columns = [ |
133 |
[% IF show_patron_column %] |
134 |
{ |
135 |
"data": "patron.firstname:patron.surname:patron.cardnumber", |
136 |
"render": function(data, type, row, meta) { |
137 |
return $patron_to_html( row.patron, { display_cardnumber: true, url: true } ); |
138 |
} |
139 |
}, |
140 |
[% END %] |
141 |
{ |
142 |
"data": "item.external_id", |
143 |
"render": function(data, type, row, meta) { |
144 |
if ( data != null ) { |
145 |
return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber='+encodeURIComponent(row.item.biblio_id)+'&itemnumber='+encodeURIComponent(row.item_id)+'">'+escape_str(row.item.external_id)+'</a>'; |
146 |
} |
147 |
else { |
148 |
return ''; |
149 |
} |
150 |
} |
151 |
}, |
152 |
{ |
153 |
"data": "library.name", |
154 |
"render": function(data) { |
155 |
return escape_str(data); |
156 |
} |
157 |
}, |
158 |
{ |
159 |
"data": "issuer.firstname:issuer.surname:issuer.cardnumber", |
160 |
"render": function(data, type, row, meta) { |
161 |
return (row.issuer) ? $patron_to_html( row.issuer, { display_cardnumber: true, url: true } ) : ''; |
162 |
} |
163 |
}, |
164 |
{ |
165 |
"data": "renewals", |
166 |
"render": function( data, type, row ) { |
167 |
var res = ( data > 0 ) ? _("Yes") : _("No"); |
168 |
if ( data > 0 && row.last_renewed_date != null ) { |
169 |
res += ', <small>' + _("last on:") + ' ' + $datetime(row.last_renewed_date) + '</small>'; |
170 |
} |
171 |
|
172 |
return res; |
173 |
} |
174 |
}, |
175 |
{ |
176 |
"data": "checkout_date", |
177 |
"render": function(data) { |
178 |
return $datetime(data); |
179 |
} |
180 |
}, |
181 |
{ |
182 |
"data": "due_date", |
183 |
"render": function(data) { |
184 |
return $datetime(data); |
185 |
} |
186 |
} |
187 |
]; |
188 |
|
189 |
var url = '/api/v1/biblios/[% biblio.biblionumber | uri %]/checkouts'; |
190 |
|
191 |
if ( checked_in ) { |
192 |
columns.push({ |
193 |
"data": "checkin_date", |
194 |
"render": function(data) { |
195 |
return $datetime(data); |
196 |
} |
197 |
}); |
198 |
|
199 |
url += '?checked_in=1'; |
200 |
} |
201 |
|
202 |
return $(table_selector).kohaTable({ |
203 |
"ajax": { |
204 |
"url": url |
205 |
}, |
206 |
"header_filter": true, |
207 |
"embed": [ |
208 |
"issuer", |
209 |
"item", |
210 |
"library", |
211 |
"patron" |
212 |
], |
213 |
"order": [ [ default_sort_column, "desc" ] ], |
214 |
"columns": columns |
215 |
}, columns_settings); |
216 |
} |
217 |
|
134 |
var columns_settings = [% TablesSettings.GetColumns('catalogue', 'detail', 'checkoutshistory-table', 'json') %]; |
218 |
var columns_settings = [% TablesSettings.GetColumns('catalogue', 'detail', 'checkoutshistory-table', 'json') %]; |
135 |
[% UNLESS show_patron_column %] |
219 |
[% UNLESS show_patron_column %] |
136 |
// Remove the patron column definition |
220 |
// Remove the patron column definition |
137 |
columns_settings.splice(0,1); |
221 |
columns_settings.splice(0,1); |
138 |
[% END %] |
222 |
[% END %] |
139 |
var table = KohaTable("table_issues", { |
223 |
|
140 |
"sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', |
224 |
var show_patron_column = [% IF show_patron_column %]1[% ELSE %]0[% END %]; |
141 |
"aaSorting": [[ 5, "desc" ]], |
225 |
var default_sort_column = 3 + show_patron_column; |
142 |
"sPaginationType": "full_numbers" |
226 |
|
143 |
}, columns_settings); |
227 |
var old_checkouts = initialize_checkouts_table( '#old_checkouts', default_sort_column, true, columns_settings ); |
|
|
228 |
var current_checkouts = initialize_checkouts_table( '#current_checkouts', default_sort_column, false, columns_settings.slice(0,-1) ); |
144 |
}); |
229 |
}); |
145 |
</script> |
230 |
</script> |
146 |
[% END %] |
231 |
[% END %] |
147 |
- |
|
|