Lines 1-3
Link Here
|
|
|
1 |
(function($) { |
2 |
|
3 |
var ymd = $.datepicker.formatDate('yy-mm-dd', new Date()); |
4 |
|
5 |
function enableGrouping(datatable) { |
6 |
datatable.rowGrouping({ |
7 |
iGroupingColumnIndex: 2, |
8 |
iGroupingOrderByColumnIndex: 1, |
9 |
sGroupingColumnSortDirection: "asc" |
10 |
}); |
11 |
} |
12 |
|
13 |
function disableGrouping(datatable) { |
14 |
var oSettings = datatable.fnSettings(); |
15 |
for (f = 0; f < oSettings.aoDrawCallback.length; f++) { |
16 |
if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') { |
17 |
oSettings.aoDrawCallback.splice(f, 1); |
18 |
datatable.fnDraw(); |
19 |
break; |
20 |
} |
21 |
} |
22 |
} |
23 |
|
24 |
function loadTableData(datatable, borrowernumbers, offset, count) { |
25 |
offset = offset ? offset : 0; |
26 |
count = count ? count : 100; |
27 |
|
28 |
var args = { |
29 |
"borrowernumber": borrowernumbers, |
30 |
"offset": offset, |
31 |
"count": count |
32 |
}; |
33 |
|
34 |
$.ajax({ |
35 |
dataType: "json", |
36 |
traditional: true, |
37 |
url: '/cgi-bin/koha/svc/checkouts', |
38 |
data: args, |
39 |
success: function(data) { |
40 |
if (data.length) { |
41 |
datatable.fnAddData(data); |
42 |
} |
43 |
|
44 |
if (data.length < count) { |
45 |
var oSettings = datatable.fnSettings(); |
46 |
oSettings.bDataFullyLoaded = true; |
47 |
|
48 |
// We need to redraw to update the info text |
49 |
datatable.fnDraw(); |
50 |
} else { |
51 |
loadTableData(datatable, borrowernumbers, offset + count, count); |
52 |
} |
53 |
} |
54 |
}); |
55 |
} |
56 |
|
57 |
function dtSimpleInfoCallback (oSettings, iStart, iEnd, iMax, iTotal, sPre) { |
58 |
var sInfo; |
59 |
var oLanguage = oSettings.oLanguage; |
60 |
|
61 |
if (iTotal > 0) { |
62 |
sInfo = oLanguage.sInfoSimple.replace('_TOTAL_', iTotal); |
63 |
} else { |
64 |
sInfo = oLanguage.sInfoEmpty; |
65 |
} |
66 |
|
67 |
if (iMax > iTotal) { |
68 |
sInfo += ' ' + oLanguage.sInfoFiltered.replace('_MAX_', iMax); |
69 |
} |
70 |
|
71 |
if (!oSettings.bDataFullyLoaded) { |
72 |
sInfo += ' (' + oLanguage.sLoadingRecords + ')'; |
73 |
} |
74 |
|
75 |
return sInfo; |
76 |
} |
77 |
|
78 |
var mDataProps = { |
79 |
groupOrder: function( oObj ) { |
80 |
if ( oObj.issued_today ) { |
81 |
return "0"; |
82 |
} else { |
83 |
return "1"; |
84 |
} |
85 |
}, |
86 |
groupName: function( oObj ) { |
87 |
if ( oObj.issued_today ) { |
88 |
return "<strong>" + TODAYS_CHECKOUTS + "</strong>"; |
89 |
} else { |
90 |
return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>"; |
91 |
} |
92 |
}, |
93 |
dateDueFormatted: function( oObj ) { |
94 |
var due = oObj.date_due_formatted; |
95 |
|
96 |
if ( oObj.date_due_overdue ) { |
97 |
due = "<span class='overdue'>" + due + "</span>"; |
98 |
} |
99 |
|
100 |
if ( oObj.lost ) { |
101 |
due += "<span class='lost'>" + oObj.lost + "</span>"; |
102 |
} |
103 |
|
104 |
if ( oObj.damaged ) { |
105 |
due += "<span class='dmg'>" + oObj.damaged + "</span>"; |
106 |
} |
107 |
|
108 |
due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; |
109 |
|
110 |
return due; |
111 |
}, |
112 |
title: function ( oObj ) { |
113 |
var title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
114 |
+ oObj.biblionumber |
115 |
+ "'>" |
116 |
+ oObj.title; |
117 |
|
118 |
$.each(oObj.subtitle, function( index, value ) { |
119 |
title += " " + value.subfield; |
120 |
}); |
121 |
|
122 |
title += "</a></span>"; |
123 |
|
124 |
if ( oObj.author ) { |
125 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); |
126 |
} |
127 |
|
128 |
if ( oObj.itemnotes ) { |
129 |
var span_class = ""; |
130 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
131 |
span_class = "circ-hlt"; |
132 |
} |
133 |
title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>" |
134 |
} |
135 |
|
136 |
var onsite_checkout = ''; |
137 |
if ( oObj.onsite_checkout == 1 ) { |
138 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
139 |
} |
140 |
|
141 |
title += " " |
142 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
143 |
+ oObj.biblionumber |
144 |
+ "&itemnumber=" |
145 |
+ oObj.itemnumber |
146 |
+ "#" |
147 |
+ oObj.itemnumber |
148 |
+ "'>" |
149 |
+ oObj.barcode |
150 |
+ "</a>" |
151 |
+ onsite_checkout; |
152 |
|
153 |
return title; |
154 |
}, |
155 |
charge: function ( oObj ) { |
156 |
if ( ! oObj.charge ) oObj.charge = 0; |
157 |
return parseFloat(oObj.charge).toFixed(2); |
158 |
}, |
159 |
fine: function ( oObj ) { |
160 |
if ( ! oObj.fine ) oObj.fine = 0; |
161 |
return parseFloat(oObj.fine).toFixed(2); |
162 |
}, |
163 |
price: function ( oObj ) { |
164 |
if ( ! oObj.price ) oObj.price = 0; |
165 |
return parseFloat(oObj.price).toFixed(2); |
166 |
}, |
167 |
renew: function ( oObj ) { |
168 |
var content = ""; |
169 |
var span_style = ""; |
170 |
var span_class = ""; |
171 |
|
172 |
content += "<span>"; |
173 |
content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; |
174 |
|
175 |
if ( oObj.can_renew ) { |
176 |
// Do nothing |
177 |
} else if ( oObj.can_renew_error == "on_reserve" ) { |
178 |
content += "<span class='renewals-disabled-no-override'>" |
179 |
+ "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>" |
180 |
+ "</span>"; |
181 |
|
182 |
span_style = "display: none"; |
183 |
span_class = "renewals-allowed"; |
184 |
} else if ( oObj.can_renew_error == "too_many" ) { |
185 |
content += "<span class='renewals-disabled'>" |
186 |
+ NOT_RENEWABLE |
187 |
+ "</span>"; |
188 |
|
189 |
span_style = "display: none"; |
190 |
span_class = "renewals-allowed"; |
191 |
} else if ( oObj.can_renew_error == "restriction" ) { |
192 |
content += "<span class='renewals-disabled'>" |
193 |
+ NOT_RENEWABLE_RESTRICTION |
194 |
+ "</span>"; |
195 |
|
196 |
span_style = "display: none"; |
197 |
span_class = "renewals-allowed"; |
198 |
} else if ( oObj.can_renew_error == "overdue" ) { |
199 |
content += "<span class='renewals-disabled'>" |
200 |
+ NOT_RENEWABLE_OVERDUE |
201 |
+ "</span>"; |
202 |
|
203 |
span_style = "display: none"; |
204 |
span_class = "renewals-allowed"; |
205 |
} else if ( oObj.can_renew_error == "too_soon" ) { |
206 |
content += "<span class='renewals-disabled'>" |
207 |
+ NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) |
208 |
+ "</span>"; |
209 |
|
210 |
span_style = "display: none"; |
211 |
span_class = "renewals-allowed"; |
212 |
} else if ( oObj.can_renew_error == "auto_too_soon" ) { |
213 |
content += "<span class='renewals-disabled'>" |
214 |
+ NOT_RENEWABLE_AUTO_TOO_SOON |
215 |
+ "</span>"; |
216 |
|
217 |
span_style = "display: none"; |
218 |
span_class = "renewals-allowed"; |
219 |
} else if ( oObj.can_renew_error == "auto_renew" ) { |
220 |
content += "<span class='renewals-disabled'>" |
221 |
+ NOT_RENEWABLE_AUTO_RENEW |
222 |
+ "</span>"; |
223 |
|
224 |
span_style = "display: none"; |
225 |
span_class = "renewals-allowed"; |
226 |
} else if ( oObj.can_renew_error == "onsite_checkout" ) { |
227 |
// Don't display something if it's an onsite checkout |
228 |
} else { |
229 |
content += "<span class='renewals-disabled'>" |
230 |
+ oObj.can_renew_error |
231 |
+ "</span>"; |
232 |
|
233 |
span_style = "display: none"; |
234 |
span_class = "renewals-allowed"; |
235 |
} |
236 |
|
237 |
var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); |
238 |
var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); |
239 |
if ( can_renew || can_force_renew ) { |
240 |
content += "<span class='" + span_class + "' style='" + span_style + "'>" |
241 |
+ "<input type='checkbox' "; |
242 |
if ( oObj.date_due_overdue && can_renew ) { |
243 |
content += "checked='checked' "; |
244 |
} |
245 |
content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" |
246 |
+ "</span>"; |
247 |
|
248 |
content += "<span class='renewals'>(" |
249 |
+ RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) |
250 |
+ ")</span>"; |
251 |
} |
252 |
|
253 |
content += "</span>"; |
254 |
|
255 |
return content; |
256 |
}, |
257 |
checkin: function ( oObj ) { |
258 |
if ( oObj.can_renew_error == "on_reserve" ) { |
259 |
return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"; |
260 |
} else { |
261 |
return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>"; |
262 |
} |
263 |
}, |
264 |
export: function ( oObj ) { |
265 |
var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />"; |
266 |
|
267 |
s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />"; |
268 |
return s; |
269 |
}, |
270 |
patron: function( oObj ) { |
271 |
return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>" |
272 |
+ oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>" |
273 |
} |
274 |
}; |
275 |
|
1 |
$(document).ready(function() { |
276 |
$(document).ready(function() { |
2 |
$.ajaxSetup ({ cache: false }); |
277 |
$.ajaxSetup ({ cache: false }); |
3 |
|
278 |
|
Lines 139-146
$(document).ready(function() {
Link Here
|
139 |
return false; |
414 |
return false; |
140 |
}); |
415 |
}); |
141 |
|
416 |
|
142 |
var ymd = $.datepicker.formatDate('yy-mm-dd', new Date()); |
|
|
143 |
|
144 |
$('#issues-table').hide(); |
417 |
$('#issues-table').hide(); |
145 |
$('#issues-table-actions').hide(); |
418 |
$('#issues-table-actions').hide(); |
146 |
$('#issues-table-load-immediately').change(function(){ |
419 |
$('#issues-table-load-immediately').change(function(){ |
Lines 174-265
$(document).ready(function() {
Link Here
|
174 |
"sProcessing": MSG_DT_LOADING_RECORDS, |
447 |
"sProcessing": MSG_DT_LOADING_RECORDS, |
175 |
}, |
448 |
}, |
176 |
"bAutoWidth": false, |
449 |
"bAutoWidth": false, |
177 |
"sDom": 'C<"clearfix">rt', |
450 |
"bPaginate": false, |
|
|
451 |
"sDom": 'C<"top pager"if>rt', |
178 |
"aoColumns": [ |
452 |
"aoColumns": [ |
179 |
{ |
453 |
{ "mDataProp": "sort_order" }, |
180 |
"mDataProp": function( oObj ) { |
454 |
{ "mDataProp": mDataProps.groupOrder }, |
181 |
return oObj.sort_order; |
455 |
{ "mDataProp": mDataProps.groupName }, |
182 |
} |
456 |
{ "mDataProp": "date_due" }, |
183 |
}, |
|
|
184 |
{ |
185 |
"mDataProp": function( oObj ) { |
186 |
if ( oObj.issued_today ) { |
187 |
return "<strong>" + TODAYS_CHECKOUTS + "</strong>"; |
188 |
} else { |
189 |
return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>"; |
190 |
} |
191 |
} |
192 |
}, |
193 |
{ |
194 |
"mDataProp": "date_due", |
195 |
"bVisible": false, |
196 |
}, |
197 |
{ |
457 |
{ |
198 |
"iDataSort": 2, // Sort on hidden unformatted date due column |
458 |
"iDataSort": 2, // Sort on hidden unformatted date due column |
199 |
"mDataProp": function( oObj ) { |
459 |
"mDataProp": mDataProps.dateDueFormatted |
200 |
var due = oObj.date_due_formatted; |
|
|
201 |
|
202 |
if ( oObj.date_due_overdue ) { |
203 |
due = "<span class='overdue'>" + due + "</span>"; |
204 |
} |
205 |
|
206 |
if ( oObj.lost ) { |
207 |
due += "<span class='lost'>" + oObj.lost + "</span>"; |
208 |
} |
209 |
|
210 |
if ( oObj.damaged ) { |
211 |
due += "<span class='dmg'>" + oObj.damaged + "</span>"; |
212 |
} |
213 |
|
214 |
due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; |
215 |
|
216 |
return due; |
217 |
} |
218 |
}, |
460 |
}, |
219 |
{ |
461 |
{ |
220 |
"mDataProp": function ( oObj ) { |
462 |
"mDataProp": mDataProps.title, |
221 |
title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
|
|
222 |
+ oObj.biblionumber |
223 |
+ "'>" |
224 |
+ oObj.title; |
225 |
|
226 |
$.each(oObj.subtitle, function( index, value ) { |
227 |
title += " " + value.subfield; |
228 |
}); |
229 |
|
230 |
title += "</a></span>"; |
231 |
|
232 |
if ( oObj.author ) { |
233 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); |
234 |
} |
235 |
|
236 |
if ( oObj.itemnotes ) { |
237 |
var span_class = ""; |
238 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
239 |
span_class = "circ-hlt"; |
240 |
} |
241 |
title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>" |
242 |
} |
243 |
|
244 |
var onsite_checkout = ''; |
245 |
if ( oObj.onsite_checkout == 1 ) { |
246 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
247 |
} |
248 |
|
249 |
title += " " |
250 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
251 |
+ oObj.biblionumber |
252 |
+ "&itemnumber=" |
253 |
+ oObj.itemnumber |
254 |
+ "#" |
255 |
+ oObj.itemnumber |
256 |
+ "'>" |
257 |
+ oObj.barcode |
258 |
+ "</a>" |
259 |
+ onsite_checkout; |
260 |
|
261 |
return title; |
262 |
}, |
263 |
"sType": "anti-the" |
463 |
"sType": "anti-the" |
264 |
}, |
464 |
}, |
265 |
{ "mDataProp": "itemtype_description" }, |
465 |
{ "mDataProp": "itemtype_description" }, |
Lines 267-402
$(document).ready(function() {
Link Here
|
267 |
{ "mDataProp": "issuedate_formatted" }, |
467 |
{ "mDataProp": "issuedate_formatted" }, |
268 |
{ "mDataProp": "branchname" }, |
468 |
{ "mDataProp": "branchname" }, |
269 |
{ "mDataProp": "itemcallnumber" }, |
469 |
{ "mDataProp": "itemcallnumber" }, |
270 |
{ |
470 |
{ "mDataProp": mDataProps.charge }, |
271 |
"mDataProp": function ( oObj ) { |
471 |
{ "mDataProp": mDataProps.fine }, |
272 |
if ( ! oObj.charge ) oObj.charge = 0; |
472 |
{ "mDataProp": mDataProps.price }, |
273 |
return parseFloat(oObj.charge).toFixed(2); |
|
|
274 |
} |
275 |
}, |
276 |
{ |
277 |
"mDataProp": function ( oObj ) { |
278 |
if ( ! oObj.fine ) oObj.fine = 0; |
279 |
return parseFloat(oObj.fine).toFixed(2); |
280 |
} |
281 |
}, |
282 |
{ |
283 |
"mDataProp": function ( oObj ) { |
284 |
if ( ! oObj.price ) oObj.price = 0; |
285 |
return parseFloat(oObj.price).toFixed(2); |
286 |
} |
287 |
}, |
288 |
{ |
473 |
{ |
289 |
"bSortable": false, |
474 |
"bSortable": false, |
290 |
"mDataProp": function ( oObj ) { |
475 |
"mDataProp": mDataProps.renew |
291 |
var content = ""; |
|
|
292 |
var span_style = ""; |
293 |
var span_class = ""; |
294 |
|
295 |
content += "<span>"; |
296 |
content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; |
297 |
|
298 |
if ( oObj.can_renew ) { |
299 |
// Do nothing |
300 |
} else if ( oObj.can_renew_error == "on_reserve" ) { |
301 |
content += "<span class='renewals-disabled-no-override'>" |
302 |
+ "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>" |
303 |
+ "</span>"; |
304 |
|
305 |
span_style = "display: none"; |
306 |
span_class = "renewals-allowed"; |
307 |
} else if ( oObj.can_renew_error == "too_many" ) { |
308 |
content += "<span class='renewals-disabled'>" |
309 |
+ NOT_RENEWABLE |
310 |
+ "</span>"; |
311 |
|
312 |
span_style = "display: none"; |
313 |
span_class = "renewals-allowed"; |
314 |
} else if ( oObj.can_renew_error == "restriction" ) { |
315 |
content += "<span class='renewals-disabled'>" |
316 |
+ NOT_RENEWABLE_RESTRICTION |
317 |
+ "</span>"; |
318 |
|
319 |
span_style = "display: none"; |
320 |
span_class = "renewals-allowed"; |
321 |
} else if ( oObj.can_renew_error == "overdue" ) { |
322 |
content += "<span class='renewals-disabled'>" |
323 |
+ NOT_RENEWABLE_OVERDUE |
324 |
+ "</span>"; |
325 |
|
326 |
span_style = "display: none"; |
327 |
span_class = "renewals-allowed"; |
328 |
} else if ( oObj.can_renew_error == "too_soon" ) { |
329 |
content += "<span class='renewals-disabled'>" |
330 |
+ NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) |
331 |
+ "</span>"; |
332 |
|
333 |
span_style = "display: none"; |
334 |
span_class = "renewals-allowed"; |
335 |
} else if ( oObj.can_renew_error == "auto_too_soon" ) { |
336 |
content += "<span class='renewals-disabled'>" |
337 |
+ NOT_RENEWABLE_AUTO_TOO_SOON |
338 |
+ "</span>"; |
339 |
|
340 |
span_style = "display: none"; |
341 |
span_class = "renewals-allowed"; |
342 |
} else if ( oObj.can_renew_error == "auto_renew" ) { |
343 |
content += "<span class='renewals-disabled'>" |
344 |
+ NOT_RENEWABLE_AUTO_RENEW |
345 |
+ "</span>"; |
346 |
|
347 |
span_style = "display: none"; |
348 |
span_class = "renewals-allowed"; |
349 |
} else if ( oObj.can_renew_error == "onsite_checkout" ) { |
350 |
// Don't display something if it's an onsite checkout |
351 |
} else { |
352 |
content += "<span class='renewals-disabled'>" |
353 |
+ oObj.can_renew_error |
354 |
+ "</span>"; |
355 |
|
356 |
span_style = "display: none"; |
357 |
span_class = "renewals-allowed"; |
358 |
} |
359 |
|
360 |
var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); |
361 |
var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); |
362 |
if ( can_renew || can_force_renew ) { |
363 |
content += "<span class='" + span_class + "' style='" + span_style + "'>" |
364 |
+ "<input type='checkbox' "; |
365 |
if ( oObj.date_due_overdue && can_renew ) { |
366 |
content += "checked='checked' "; |
367 |
} |
368 |
content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" |
369 |
+ "</span>"; |
370 |
|
371 |
content += "<span class='renewals'>(" |
372 |
+ RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) |
373 |
+ ")</span>"; |
374 |
} |
375 |
|
376 |
content += "</span>"; |
377 |
|
378 |
return content; |
379 |
} |
380 |
}, |
476 |
}, |
381 |
{ |
477 |
{ |
382 |
"bSortable": false, |
478 |
"bSortable": false, |
383 |
"mDataProp": function ( oObj ) { |
479 |
"mDataProp": mDataProps.checkin |
384 |
if ( oObj.can_renew_error == "on_reserve" ) { |
|
|
385 |
return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"; |
386 |
} else { |
387 |
return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>"; |
388 |
} |
389 |
} |
390 |
}, |
480 |
}, |
391 |
{ |
481 |
{ |
392 |
"bVisible": exports_enabled ? true : false, |
482 |
"bVisible": exports_enabled ? true : false, |
393 |
"bSortable": false, |
483 |
"bSortable": false, |
394 |
"mDataProp": function ( oObj ) { |
484 |
"mDataProp": mDataProps.checkin |
395 |
var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />"; |
|
|
396 |
|
397 |
s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />"; |
398 |
return s; |
399 |
} |
400 |
} |
485 |
} |
401 |
], |
486 |
], |
402 |
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) { |
487 |
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) { |
Lines 412-449
$(document).ready(function() {
Link Here
|
412 |
$("#totalfine").html(total_fine.toFixed(2)); |
497 |
$("#totalfine").html(total_fine.toFixed(2)); |
413 |
$("#totalprice").html(total_price.toFixed(2)); |
498 |
$("#totalprice").html(total_price.toFixed(2)); |
414 |
}, |
499 |
}, |
415 |
"bPaginate": false, |
500 |
"fnInfoCallback": dtSimpleInfoCallback |
416 |
"bProcessing": true, |
501 |
}, columns_settings); |
417 |
"bServerSide": false, |
502 |
|
418 |
"sAjaxSource": '/cgi-bin/koha/svc/checkouts', |
503 |
enableGrouping(issuesTable); |
419 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
504 |
|
420 |
aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); |
505 |
var groupingSwitch = $('<input type="checkbox">') |
421 |
|
506 |
.attr('id', 'issues-table-row-grouping-switch') |
422 |
$.getJSON( sSource, aoData, function (json) { |
507 |
.attr('checked', 'checked') |
423 |
fnCallback(json) |
508 |
.css('vertical-align', 'middle') |
424 |
} ); |
509 |
.change(function() { |
425 |
}, |
510 |
if ($(this).is(':checked')) { |
426 |
"fnInitComplete": function(oSettings) { |
511 |
enableGrouping(issuesTable); |
427 |
// Disable rowGrouping plugin after first use |
512 |
} else { |
428 |
// so any sorting on the table doesn't use it |
513 |
disableGrouping(issuesTable); |
429 |
var oSettings = issuesTable.fnSettings(); |
514 |
} |
430 |
|
515 |
}); |
431 |
for (f = 0; f < oSettings.aoDrawCallback.length; f++) { |
516 |
$('<div></div>') |
432 |
if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') { |
517 |
.css('float', 'left') |
433 |
oSettings.aoDrawCallback.splice(f, 1); |
518 |
.css('padding', '0.3em 0.5em') |
434 |
break; |
519 |
.css('line-height', '1.9em') |
435 |
} |
520 |
.append(groupingSwitch) |
436 |
} |
521 |
.append(' ') |
|
|
522 |
.append('<label for="issues-table-row-grouping-switch">' + GROUP_TODAYS_CHECKOUTS + '</label>') |
523 |
.appendTo('#issues-table_wrapper .top.pager'); |
437 |
|
524 |
|
438 |
oSettings.aaSortingFixed = null; |
525 |
loadTableData(issuesTable, borrowernumber); |
439 |
}, |
|
|
440 |
}, columns_settings).rowGrouping( |
441 |
{ |
442 |
iGroupingColumnIndex: 1, |
443 |
iGroupingOrderByColumnIndex: 0, |
444 |
sGroupingColumnSortDirection: "asc" |
445 |
} |
446 |
); |
447 |
|
526 |
|
448 |
if ( $("#issues-table").length ) { |
527 |
if ( $("#issues-table").length ) { |
449 |
$("#issues-table_processing").position({ |
528 |
$("#issues-table_processing").position({ |
Lines 457-527
$(document).ready(function() {
Link Here
|
457 |
var relativesIssuesTable; |
536 |
var relativesIssuesTable; |
458 |
$("#relatives-issues-tab").click( function() { |
537 |
$("#relatives-issues-tab").click( function() { |
459 |
if ( ! relativesIssuesTable ) { |
538 |
if ( ! relativesIssuesTable ) { |
460 |
relativesIssuesTable = $("#relatives-issues-table").dataTable({ |
539 |
relativesIssuesTable = KohaTable("#relatives-issues-table", { |
461 |
"bAutoWidth": false, |
540 |
"bAutoWidth": false, |
462 |
"sDom": "rt", |
541 |
"sDom": 'C<"top pager"if>rt', |
463 |
"aaSorting": [], |
542 |
"aaSorting": [], |
|
|
543 |
"bPaginate": false, |
464 |
"aoColumns": [ |
544 |
"aoColumns": [ |
465 |
{ |
545 |
{ "mDataProp": "date_due" }, |
466 |
"mDataProp": "date_due", |
|
|
467 |
"bVisible": false, |
468 |
}, |
469 |
{ |
546 |
{ |
470 |
"iDataSort": 1, // Sort on hidden unformatted date due column |
547 |
"iDataSort": 1, // Sort on hidden unformatted date due column |
471 |
"mDataProp": function( oObj ) { |
548 |
"mDataProp": mDataProps.dateDueFormatted |
472 |
var today = new Date(); |
|
|
473 |
var due = new Date( oObj.date_due ); |
474 |
if ( today > due ) { |
475 |
return "<span class='overdue'>" + oObj.date_due_formatted + "</span>"; |
476 |
} else { |
477 |
return oObj.date_due_formatted; |
478 |
} |
479 |
} |
480 |
}, |
549 |
}, |
481 |
{ |
550 |
{ |
482 |
"mDataProp": function ( oObj ) { |
551 |
"mDataProp": mDataProps.title, |
483 |
title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
|
|
484 |
+ oObj.biblionumber |
485 |
+ "'>" |
486 |
+ oObj.title; |
487 |
|
488 |
$.each(oObj.subtitle, function( index, value ) { |
489 |
title += " " + value.subfield; |
490 |
}); |
491 |
|
492 |
title += "</a></span>"; |
493 |
|
494 |
if ( oObj.author ) { |
495 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author ); |
496 |
} |
497 |
|
498 |
if ( oObj.itemnotes ) { |
499 |
var span_class = ""; |
500 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
501 |
span_class = "circ-hlt"; |
502 |
} |
503 |
title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>" |
504 |
} |
505 |
|
506 |
var onsite_checkout = ''; |
507 |
if ( oObj.onsite_checkout == 1 ) { |
508 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
509 |
} |
510 |
|
511 |
title += " " |
512 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
513 |
+ oObj.biblionumber |
514 |
+ "&itemnumber=" |
515 |
+ oObj.itemnumber |
516 |
+ "#" |
517 |
+ oObj.itemnumber |
518 |
+ "'>" |
519 |
+ oObj.barcode |
520 |
+ "</a>" |
521 |
+ onsite_checkout; |
522 |
|
523 |
return title; |
524 |
}, |
525 |
"sType": "anti-the" |
552 |
"sType": "anti-the" |
526 |
}, |
553 |
}, |
527 |
{ "mDataProp": "itemtype" }, |
554 |
{ "mDataProp": "itemtype" }, |
Lines 529-573
$(document).ready(function() {
Link Here
|
529 |
{ "mDataProp": "issuedate_formatted" }, |
556 |
{ "mDataProp": "issuedate_formatted" }, |
530 |
{ "mDataProp": "branchname" }, |
557 |
{ "mDataProp": "branchname" }, |
531 |
{ "mDataProp": "itemcallnumber" }, |
558 |
{ "mDataProp": "itemcallnumber" }, |
532 |
{ |
559 |
{ "mDataProp": mDataProps.charge }, |
533 |
"mDataProp": function ( oObj ) { |
560 |
{ "mDataProp": mDataProps.fine }, |
534 |
if ( ! oObj.charge ) oObj.charge = 0; |
561 |
{ "mDataProp": mDataProps.price }, |
535 |
return parseFloat(oObj.charge).toFixed(2); |
562 |
{ "mDataProp": mDataProps.patron } |
536 |
} |
|
|
537 |
}, |
538 |
{ |
539 |
"mDataProp": function ( oObj ) { |
540 |
if ( ! oObj.fine ) oObj.fine = 0; |
541 |
return parseFloat(oObj.fine).toFixed(2); |
542 |
} |
543 |
}, |
544 |
{ |
545 |
"mDataProp": function ( oObj ) { |
546 |
if ( ! oObj.price ) oObj.price = 0; |
547 |
return parseFloat(oObj.price).toFixed(2); |
548 |
} |
549 |
}, |
550 |
{ |
551 |
"mDataProp": function( oObj ) { |
552 |
return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>" |
553 |
+ oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>" |
554 |
} |
555 |
}, |
556 |
], |
563 |
], |
557 |
"bPaginate": false, |
564 |
"fnInfoCallback": dtSimpleInfoCallback |
558 |
"bProcessing": true, |
565 |
}, relatives_columns_settings); |
559 |
"bServerSide": false, |
566 |
loadTableData(relativesIssuesTable, relatives_borrowernumbers); |
560 |
"sAjaxSource": '/cgi-bin/koha/svc/checkouts', |
|
|
561 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
562 |
$.each(relatives_borrowernumbers, function( index, value ) { |
563 |
aoData.push( { "name": "borrowernumber", "value": value } ); |
564 |
}); |
565 |
|
566 |
$.getJSON( sSource, aoData, function (json) { |
567 |
fnCallback(json) |
568 |
} ); |
569 |
}, |
570 |
}); |
571 |
} |
567 |
} |
572 |
}); |
568 |
}); |
573 |
|
569 |
|
Lines 587-590
$(document).ready(function() {
Link Here
|
587 |
} |
583 |
} |
588 |
} ).attr( 'checked', false ); |
584 |
} ).attr( 'checked', false ); |
589 |
} |
585 |
} |
590 |
}); |
586 |
}); |
|
|
587 |
|
588 |
})(jQuery); |