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: 1, |
8 |
iGroupingOrderByColumnIndex: 0, |
9 |
sGroupingColumnSortDirection: "desc" |
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 |
oSettings.aaSortingFixed = null; |
19 |
datatable.fnDraw(); |
20 |
break; |
21 |
} |
22 |
} |
23 |
} |
24 |
|
25 |
var mRenders = { |
26 |
groupOrder: function (oData, sType, oObj) { |
27 |
if ( oObj.issued_today ) { |
28 |
return "1"; |
29 |
} else { |
30 |
return "0"; |
31 |
} |
32 |
}, |
33 |
groupName: function (oData, sType, oObj) { |
34 |
if (oObj.issued_today) { |
35 |
return "<strong>" + TODAYS_CHECKOUTS + "</strong>"; |
36 |
} else { |
37 |
return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>"; |
38 |
} |
39 |
}, |
40 |
dateDueFormatted: function (oData, sType, oObj) { |
41 |
var due = oObj.date_due_formatted; |
42 |
|
43 |
if ( oObj.date_due_overdue ) { |
44 |
due = "<span class='overdue'>" + due + "</span>"; |
45 |
} |
46 |
|
47 |
due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; |
48 |
|
49 |
if ( oObj.lost ) { |
50 |
due += "<span class='lost'>" + oObj.lost.escapeHtml() + "</span>"; |
51 |
} |
52 |
|
53 |
if ( oObj.damaged ) { |
54 |
due += "<span class='dmg'>" + oObj.damaged.escapeHtml() + "</span>"; |
55 |
} |
56 |
|
57 |
return due; |
58 |
}, |
59 |
title: function (oData, sType, oObj) { |
60 |
var title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
61 |
+ oObj.biblionumber |
62 |
+ "'>" |
63 |
+ oObj.title.escapeHtml(); |
64 |
|
65 |
$.each(oObj.subtitle, function( index, value ) { |
66 |
title += " " + value.subfield.escapeHtml(); |
67 |
}); |
68 |
|
69 |
if ( oObj.enumchron ) { |
70 |
title += " (" + oObj.enumchron.escapeHtml() + ")"; |
71 |
} |
72 |
|
73 |
title += "</a></span>"; |
74 |
|
75 |
if ( oObj.author ) { |
76 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author.escapeHtml() ); |
77 |
} |
78 |
|
79 |
if ( oObj.itemnotes ) { |
80 |
var span_class = "text-muted"; |
81 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
82 |
span_class = "circ-hlt"; |
83 |
} |
84 |
title += " - <span class='" + span_class + " item-note-public'>" + oObj.itemnotes.escapeHtml() + "</span>"; |
85 |
} |
86 |
|
87 |
if ( oObj.itemnotes_nonpublic ) { |
88 |
var span_class = "text-danger"; |
89 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
90 |
span_class = "circ-hlt"; |
91 |
} |
92 |
title += " - <span class='" + span_class + " item-note-nonpublic'>" + oObj.itemnotes_nonpublic.escapeHtml() + "</span>"; |
93 |
} |
94 |
|
95 |
var onsite_checkout = ''; |
96 |
if ( oObj.onsite_checkout == 1 ) { |
97 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
98 |
} |
99 |
|
100 |
title += " " |
101 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
102 |
+ oObj.biblionumber |
103 |
+ "&itemnumber=" |
104 |
+ oObj.itemnumber |
105 |
+ "#" |
106 |
+ oObj.itemnumber |
107 |
+ "'>" |
108 |
+ oObj.barcode.escapeHtml() |
109 |
+ "</a>" |
110 |
+ onsite_checkout |
111 |
|
112 |
return title; |
113 |
}, |
114 |
itemtype: function (oData, sType, oObj) { |
115 |
return oObj.itemtype_description.escapeHtml(); |
116 |
}, |
117 |
collection: function (oData, sType, oObj) { |
118 |
return oObj.collection.escapeHtml(); |
119 |
}, |
120 |
location: function (oData, sType, oObj) { |
121 |
return oObj.location.escapeHtml(); |
122 |
}, |
123 |
homebranch: function (oData, sType, oObj) { |
124 |
return oObj.homebranch.escapeHtml(); |
125 |
}, |
126 |
issuedate: function (oData, sType, oObj) { |
127 |
return oObj.issuedate_formatted; |
128 |
}, |
129 |
branch: function (oData, sType, oObj) { |
130 |
return oObj.branchname.escapeHtml(); |
131 |
}, |
132 |
itemcallnumber: function (oData, sType, oObj) { |
133 |
return oObj.itemcallnumber.escapeHtml(); |
134 |
}, |
135 |
charge: function (oData, sType, oObj) { |
136 |
if (!oObj.charge) oObj.charge = 0; |
137 |
return '<span style="text-align: right; display: block;">' + parseFloat(oObj.charge).toFixed(2) + '<span>'; |
138 |
}, |
139 |
fine: function (oData, sType, oObj) { |
140 |
if (!oObj.fine) oObj.fine = 0; |
141 |
return '<span style="text-align: right; display: block;">' + parseFloat(oObj.fine).toFixed(2) + '<span>'; |
142 |
}, |
143 |
price: function (oData, sType, oObj) { |
144 |
if (!oObj.price) oObj.price = 0; |
145 |
return parseFloat(oObj.price).toFixed(2); |
146 |
}, |
147 |
renew: function (oData, sType, oObj) { |
148 |
var content = ""; |
149 |
var span_style = ""; |
150 |
var span_class = ""; |
151 |
|
152 |
content += "<span>"; |
153 |
content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; |
154 |
|
155 |
if ( oObj.can_renew ) { |
156 |
// Do nothing |
157 |
} else if ( oObj.can_renew_error == "on_reserve" ) { |
158 |
content += "<span class='renewals-disabled-no-override'>" |
159 |
+ "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>" |
160 |
+ "</span>"; |
161 |
|
162 |
span_style = "display: none"; |
163 |
span_class = "renewals-allowed"; |
164 |
} else if ( oObj.can_renew_error == "too_many" ) { |
165 |
content += "<span class='renewals-disabled'>" |
166 |
+ NOT_RENEWABLE |
167 |
+ "</span>"; |
168 |
|
169 |
span_style = "display: none"; |
170 |
span_class = "renewals-allowed"; |
171 |
} else if ( oObj.can_renew_error == "restriction" ) { |
172 |
content += "<span class='renewals-disabled'>" |
173 |
+ NOT_RENEWABLE_RESTRICTION |
174 |
+ "</span>"; |
175 |
|
176 |
span_style = "display: none"; |
177 |
span_class = "renewals-allowed"; |
178 |
} else if ( oObj.can_renew_error == "overdue" ) { |
179 |
content += "<span class='renewals-disabled'>" |
180 |
+ NOT_RENEWABLE_OVERDUE |
181 |
+ "</span>"; |
182 |
|
183 |
span_style = "display: none"; |
184 |
span_class = "renewals-allowed"; |
185 |
} else if ( oObj.can_renew_error == "too_soon" ) { |
186 |
content += "<span class='renewals-disabled'>" |
187 |
+ NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) |
188 |
+ "</span>"; |
189 |
|
190 |
span_style = "display: none"; |
191 |
span_class = "renewals-allowed"; |
192 |
} else if ( oObj.can_renew_error == "auto_too_soon" ) { |
193 |
content += "<span class='renewals-disabled'>" |
194 |
+ NOT_RENEWABLE_AUTO_TOO_SOON |
195 |
+ "</span>"; |
196 |
|
197 |
span_style = "display: none"; |
198 |
span_class = "renewals-allowed"; |
199 |
} else if ( oObj.can_renew_error == "auto_too_late" ) { |
200 |
content += "<span class='renewals-disabled'>" |
201 |
+ NOT_RENEWABLE_AUTO_TOO_LATE |
202 |
+ "</span>"; |
203 |
|
204 |
span_style = "display: none"; |
205 |
span_class = "renewals-allowed"; |
206 |
} else if ( oObj.can_renew_error == "auto_too_much_oweing" ) { |
207 |
content += "<span class='renewals-disabled'>" |
208 |
+ NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING |
209 |
+ "</span>"; |
210 |
|
211 |
span_style = "display: none"; |
212 |
span_class = "renewals-allowed"; |
213 |
} else if ( oObj.can_renew_error == "auto_account_expired" ) { |
214 |
content += "<span class='renewals-disabled'>" |
215 |
+ NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED |
216 |
+ "</span>"; |
217 |
|
218 |
span_style = "display: none"; |
219 |
span_class = "renewals-allowed"; |
220 |
} else if ( oObj.can_renew_error == "auto_renew" ) { |
221 |
content += "<span class='renewals-disabled'>" |
222 |
+ NOT_RENEWABLE_AUTO_RENEW |
223 |
+ "</span>"; |
224 |
|
225 |
span_style = "display: none"; |
226 |
span_class = "renewals-allowed"; |
227 |
} else if ( oObj.can_renew_error == "onsite_checkout" ) { |
228 |
// Don't display something if it's an onsite checkout |
229 |
} else { |
230 |
content += "<span class='renewals-disabled'>" |
231 |
+ oObj.can_renew_error |
232 |
+ "</span>"; |
233 |
|
234 |
span_style = "display: none"; |
235 |
span_class = "renewals-allowed"; |
236 |
} |
237 |
|
238 |
var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); |
239 |
var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); |
240 |
if ( can_renew || can_force_renew ) { |
241 |
content += "<span class='" + span_class + "' style='" + span_style + "'>" |
242 |
+ "<input type='checkbox' "; |
243 |
if ( oObj.date_due_overdue && can_renew ) { |
244 |
content += "checked='checked' "; |
245 |
} |
246 |
content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" |
247 |
+ "</span>"; |
248 |
|
249 |
content += "<span class='renewals'>(" |
250 |
+ RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) |
251 |
+ ")</span>"; |
252 |
} |
253 |
|
254 |
content += "</span>"; |
255 |
|
256 |
return content; |
257 |
}, |
258 |
checkin: function (oData, sType, oObj) { |
259 |
if (oObj.can_renew_error == "on_reserve") { |
260 |
return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"; |
261 |
} else { |
262 |
return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>"; |
263 |
} |
264 |
}, |
265 |
export: function (oData, sType, oObj) { |
266 |
var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />"; |
267 |
|
268 |
s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />"; |
269 |
return s; |
270 |
}, |
271 |
patron: function (oData, sType, oObj) { |
272 |
return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>" |
273 |
+ oObj.borrower.firstname.escapeHtml() |
274 |
+ " " |
275 |
+ oObj.borrower.surname.escapeHtml() |
276 |
+ " (" + oObj.borrower.cardnumber.escapeHtml() + ")</a>" |
277 |
} |
278 |
}; |
279 |
|
1 |
$(document).ready(function() { |
280 |
$(document).ready(function() { |
2 |
$.ajaxSetup ({ cache: false }); |
281 |
$.ajaxSetup ({ cache: false }); |
3 |
|
282 |
|
Lines 152-159
$(document).ready(function() {
Link Here
|
152 |
return false; |
431 |
return false; |
153 |
}); |
432 |
}); |
154 |
|
433 |
|
155 |
var ymd = $.datepicker.formatDate('yy-mm-dd', new Date()); |
|
|
156 |
|
157 |
$('#issues-table').hide(); |
434 |
$('#issues-table').hide(); |
158 |
$('#issues-table-actions').hide(); |
435 |
$('#issues-table-actions').hide(); |
159 |
$('#issues-table-load-immediately').change(function(){ |
436 |
$('#issues-table-load-immediately').change(function(){ |
Lines 187-202
$(document).ready(function() {
Link Here
|
187 |
"sProcessing": MSG_DT_LOADING_RECORDS, |
464 |
"sProcessing": MSG_DT_LOADING_RECORDS, |
188 |
}, |
465 |
}, |
189 |
"bAutoWidth": false, |
466 |
"bAutoWidth": false, |
190 |
"dom": 'B<"clearfix">rt', |
467 |
"bProcessing": true, |
|
|
468 |
"bServerSide": ServerSideCheckoutsTables, |
469 |
"sAjaxSource": "/cgi-bin/koha/svc/checkouts", |
470 |
"fnServerParams": function (aoData) { |
471 |
aoData.push({ "name": "borrowernumber", "value": borrowernumber }); |
472 |
}, |
473 |
"fnInitComplete": function(oSettings, json) { |
474 |
// Build a summary of checkouts grouped by itemtype |
475 |
var checkoutsByItype = json.aaData.reduce(function (obj, row) { |
476 |
obj[row.itemtype_description] = (obj[row.itemtype_description] || 0) + 1; |
477 |
return obj; |
478 |
}, {}); |
479 |
var ul = $('<ul>'); |
480 |
Object.keys(checkoutsByItype).sort().forEach(function (itype) { |
481 |
var li = $('<li>') |
482 |
.append($('<strong>').html(itype || MSG_NO_ITEMTYPE)) |
483 |
.append(': ' + checkoutsByItype[itype]); |
484 |
ul.append(li); |
485 |
}) |
486 |
$('<details>') |
487 |
.addClass('checkouts-by-itemtype') |
488 |
.append($('<summary>').html(MSG_CHECKOUTS_BY_ITEMTYPE)) |
489 |
.append(ul) |
490 |
.insertBefore(oSettings.nTableWrapper) |
491 |
}, |
492 |
"bPaginate": true, |
493 |
"sPaginationType": "four_button", |
494 |
"dom": 'B<"clearfix"><"top pager"ilp>rt', |
495 |
"aaSorting": [], |
191 |
"aoColumns": [ |
496 |
"aoColumns": [ |
192 |
{ |
497 |
{ |
193 |
"mDataProp": function( oObj ) { |
498 |
"mData": "issued_today", |
194 |
return oObj.sort_order; |
499 |
"mRender": mRenders.groupOrder |
195 |
} |
|
|
196 |
}, |
500 |
}, |
197 |
{ |
501 |
{ |
198 |
"mDataProp": function( oObj ) { |
502 |
"mData": function (oObj) { |
199 |
if ( oObj.issued_today ) { |
503 |
if (oObj.issued_today) { |
200 |
return "<strong>" + TODAYS_CHECKOUTS + "</strong>"; |
504 |
return "<strong>" + TODAYS_CHECKOUTS + "</strong>"; |
201 |
} else { |
505 |
} else { |
202 |
return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>"; |
506 |
return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>"; |
Lines 204-479
$(document).ready(function() {
Link Here
|
204 |
} |
508 |
} |
205 |
}, |
509 |
}, |
206 |
{ |
510 |
{ |
207 |
"mDataProp": "date_due", |
511 |
"mData": "date_due", |
208 |
"bVisible": false, |
512 |
"mRender": mRenders.dateDueFormatted |
209 |
}, |
513 |
}, |
210 |
{ |
514 |
{ |
211 |
"iDataSort": 2, // Sort on hidden unformatted date due column |
515 |
"mData": "title", |
212 |
"mDataProp": function( oObj ) { |
516 |
"mRender": mRenders.title |
213 |
var due = oObj.date_due_formatted; |
|
|
214 |
|
215 |
if ( oObj.date_due_overdue ) { |
216 |
due = "<span class='overdue'>" + due + "</span>"; |
217 |
} |
218 |
|
219 |
due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; |
220 |
|
221 |
if ( oObj.lost ) { |
222 |
due += "<span class='lost'>" + oObj.lost.escapeHtml() + "</span>"; |
223 |
} |
224 |
|
225 |
if ( oObj.damaged ) { |
226 |
due += "<span class='dmg'>" + oObj.damaged.escapeHtml() + "</span>"; |
227 |
} |
228 |
|
229 |
var patron_note = " <span class='patron_note_" + oObj.itemnumber + "'></span>"; |
230 |
due +="<br>" + patron_note; |
231 |
|
232 |
return due; |
233 |
} |
234 |
}, |
517 |
}, |
235 |
{ |
518 |
{ |
236 |
"mDataProp": function ( oObj ) { |
519 |
"mData": "itemtype", |
237 |
title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
520 |
"mRender": mRenders.itemtype |
238 |
+ oObj.biblionumber |
|
|
239 |
+ "'>" |
240 |
+ oObj.title.escapeHtml(); |
241 |
|
242 |
$.each(oObj.subtitle, function( index, value ) { |
243 |
title += " " + value.subfield.escapeHtml(); |
244 |
}); |
245 |
|
246 |
if ( oObj.enumchron ) { |
247 |
title += " (" + oObj.enumchron.escapeHtml() + ")"; |
248 |
} |
249 |
|
250 |
title += "</a></span>"; |
251 |
|
252 |
if ( oObj.author ) { |
253 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author.escapeHtml() ); |
254 |
} |
255 |
|
256 |
if ( oObj.itemnotes ) { |
257 |
var span_class = "text-muted"; |
258 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
259 |
span_class = "circ-hlt"; |
260 |
} |
261 |
title += " - <span class='" + span_class + " item-note-public'>" + oObj.itemnotes.escapeHtml() + "</span>"; |
262 |
} |
263 |
|
264 |
if ( oObj.itemnotes_nonpublic ) { |
265 |
var span_class = "text-danger"; |
266 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
267 |
span_class = "circ-hlt"; |
268 |
} |
269 |
title += " - <span class='" + span_class + " item-note-nonpublic'>" + oObj.itemnotes_nonpublic.escapeHtml() + "</span>"; |
270 |
} |
271 |
|
272 |
var onsite_checkout = ''; |
273 |
if ( oObj.onsite_checkout == 1 ) { |
274 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
275 |
} |
276 |
|
277 |
title += " " |
278 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
279 |
+ oObj.biblionumber |
280 |
+ "&itemnumber=" |
281 |
+ oObj.itemnumber |
282 |
+ "#" |
283 |
+ oObj.itemnumber |
284 |
+ "'>" |
285 |
+ oObj.barcode.escapeHtml() |
286 |
+ "</a>" |
287 |
+ onsite_checkout |
288 |
|
289 |
return title; |
290 |
}, |
291 |
"sType": "anti-the" |
292 |
}, |
521 |
}, |
293 |
{ |
522 |
{ |
294 |
"mDataProp": function ( oObj ) { |
523 |
"mData": "ccode", |
295 |
return oObj.itemtype_description.escapeHtml(); |
524 |
"mRender": mRenders.collection |
296 |
} |
|
|
297 |
}, |
525 |
}, |
298 |
{ |
526 |
{ |
299 |
"mDataProp": function ( oObj ) { |
527 |
"mData": "location", |
300 |
return oObj.collection.escapeHtml(); |
528 |
"mRender": mRenders.location |
301 |
} |
|
|
302 |
}, |
529 |
}, |
303 |
{ |
530 |
{ |
304 |
"mDataProp": function ( oObj ) { |
531 |
"mData": "homebranch", |
305 |
return oObj.location.escapeHtml(); |
532 |
"mRender": mRenders.homebranch |
306 |
} |
|
|
307 |
}, |
533 |
}, |
308 |
{ |
534 |
{ |
309 |
"mDataProp": function ( oObj ) { |
535 |
"mData": "issuedate", |
310 |
return oObj.homebranch.escapeHtml(); |
536 |
"mRender": mRenders.issuedate |
311 |
} |
|
|
312 |
}, |
537 |
}, |
313 |
{ "mDataProp": "issuedate_formatted" }, |
|
|
314 |
{ |
538 |
{ |
315 |
"mDataProp": function ( oObj ) { |
539 |
"mData": "branchcode", |
316 |
return oObj.branchname.escapeHtml(); |
540 |
"mRender": mRenders.branch |
317 |
} |
|
|
318 |
}, |
541 |
}, |
319 |
{ |
542 |
{ |
320 |
"mDataProp": function ( oObj ) { |
543 |
"mData": "itemcallnumber", |
321 |
return oObj.itemcallnumber.escapeHtml(); |
544 |
"mRender": mRender.itemcallnumber |
322 |
} |
|
|
323 |
}, |
545 |
}, |
324 |
{ |
546 |
{ |
325 |
"mDataProp": function ( oObj ) { |
547 |
"mData": "charge", |
326 |
if ( ! oObj.charge ) oObj.charge = 0; |
548 |
"mRender": mRenders.charge, |
327 |
return '<span style="text-align: right; display: block;">' + parseFloat(oObj.charge).toFixed(2) + '<span>'; |
549 |
"bSortable": ServerSideCheckoutsTables ? false : true |
328 |
} |
|
|
329 |
}, |
550 |
}, |
330 |
{ |
551 |
{ |
331 |
"mDataProp": function ( oObj ) { |
552 |
"mData": "fine", |
332 |
if ( ! oObj.fine ) oObj.fine = 0; |
553 |
"mRender": mRenders.fine, |
333 |
return '<span style="text-align: right; display: block;">' + parseFloat(oObj.fine).toFixed(2) + '<span>'; |
554 |
"bSortable": ServerSideCheckoutsTables ? false : true |
334 |
} |
|
|
335 |
}, |
555 |
}, |
336 |
{ |
556 |
{ |
337 |
"mDataProp": function ( oObj ) { |
557 |
"mData": "replacementprice", |
338 |
if ( ! oObj.price ) oObj.price = 0; |
558 |
"mRender": mRenders.price, |
339 |
return '<span style="text-align: right; display: block;">' + parseFloat(oObj.price).toFixed(2) + '<span>'; |
559 |
"bSortable": ServerSideCheckoutsTables ? false : true |
340 |
} |
|
|
341 |
}, |
560 |
}, |
342 |
{ |
561 |
{ |
343 |
"bSortable": false, |
|
|
344 |
"bVisible": AllowCirculate ? true : false, |
562 |
"bVisible": AllowCirculate ? true : false, |
345 |
"mDataProp": function ( oObj ) { |
563 |
"mRender": mRenders.renew, |
346 |
var content = ""; |
564 |
"bSortable": false |
347 |
var span_style = ""; |
|
|
348 |
var span_class = ""; |
349 |
|
350 |
content += "<span>"; |
351 |
content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; |
352 |
|
353 |
if ( oObj.can_renew ) { |
354 |
// Do nothing |
355 |
} else if ( oObj.can_renew_error == "on_reserve" ) { |
356 |
content += "<span class='renewals-disabled-no-override'>" |
357 |
+ "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>" |
358 |
+ "</span>"; |
359 |
|
360 |
span_style = "display: none"; |
361 |
span_class = "renewals-allowed"; |
362 |
} else if ( oObj.can_renew_error == "too_many" ) { |
363 |
content += "<span class='renewals-disabled'>" |
364 |
+ NOT_RENEWABLE |
365 |
+ "</span>"; |
366 |
|
367 |
span_style = "display: none"; |
368 |
span_class = "renewals-allowed"; |
369 |
} else if ( oObj.can_renew_error == "restriction" ) { |
370 |
content += "<span class='renewals-disabled'>" |
371 |
+ NOT_RENEWABLE_RESTRICTION |
372 |
+ "</span>"; |
373 |
|
374 |
span_style = "display: none"; |
375 |
span_class = "renewals-allowed"; |
376 |
} else if ( oObj.can_renew_error == "overdue" ) { |
377 |
content += "<span class='renewals-disabled'>" |
378 |
+ NOT_RENEWABLE_OVERDUE |
379 |
+ "</span>"; |
380 |
|
381 |
span_style = "display: none"; |
382 |
span_class = "renewals-allowed"; |
383 |
} else if ( oObj.can_renew_error == "too_soon" ) { |
384 |
content += "<span class='renewals-disabled'>" |
385 |
+ NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) |
386 |
+ "</span>"; |
387 |
|
388 |
span_style = "display: none"; |
389 |
span_class = "renewals-allowed"; |
390 |
} else if ( oObj.can_renew_error == "auto_too_soon" ) { |
391 |
content += "<span class='renewals-disabled'>" |
392 |
+ NOT_RENEWABLE_AUTO_TOO_SOON |
393 |
+ "</span>"; |
394 |
|
395 |
span_style = "display: none"; |
396 |
span_class = "renewals-allowed"; |
397 |
} else if ( oObj.can_renew_error == "auto_too_late" ) { |
398 |
content += "<span class='renewals-disabled'>" |
399 |
+ NOT_RENEWABLE_AUTO_TOO_LATE |
400 |
+ "</span>"; |
401 |
|
402 |
span_style = "display: none"; |
403 |
span_class = "renewals-allowed"; |
404 |
} else if ( oObj.can_renew_error == "auto_too_much_oweing" ) { |
405 |
content += "<span class='renewals-disabled'>" |
406 |
+ NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING |
407 |
+ "</span>"; |
408 |
|
409 |
span_style = "display: none"; |
410 |
span_class = "renewals-allowed"; |
411 |
} else if ( oObj.can_renew_error == "auto_account_expired" ) { |
412 |
content += "<span class='renewals-disabled'>" |
413 |
+ NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED |
414 |
+ "</span>"; |
415 |
|
416 |
span_style = "display: none"; |
417 |
span_class = "renewals-allowed"; |
418 |
} else if ( oObj.can_renew_error == "auto_renew" ) { |
419 |
content += "<span class='renewals-disabled'>" |
420 |
+ NOT_RENEWABLE_AUTO_RENEW |
421 |
+ "</span>"; |
422 |
|
423 |
span_style = "display: none"; |
424 |
span_class = "renewals-allowed"; |
425 |
} else if ( oObj.can_renew_error == "onsite_checkout" ) { |
426 |
// Don't display something if it's an onsite checkout |
427 |
} else { |
428 |
content += "<span class='renewals-disabled'>" |
429 |
+ oObj.can_renew_error |
430 |
+ "</span>"; |
431 |
|
432 |
span_style = "display: none"; |
433 |
span_class = "renewals-allowed"; |
434 |
} |
435 |
|
436 |
var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); |
437 |
var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); |
438 |
if ( can_renew || can_force_renew ) { |
439 |
content += "<span class='" + span_class + "' style='" + span_style + "'>" |
440 |
+ "<input type='checkbox' "; |
441 |
if ( oObj.date_due_overdue && can_renew ) { |
442 |
content += "checked='checked' "; |
443 |
} |
444 |
content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" |
445 |
+ "</span>"; |
446 |
|
447 |
content += "<span class='renewals'>(" |
448 |
+ RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) |
449 |
+ ")</span>"; |
450 |
} |
451 |
|
452 |
content += "</span>"; |
453 |
|
454 |
return content; |
455 |
} |
456 |
}, |
565 |
}, |
457 |
{ |
566 |
{ |
458 |
"bSortable": false, |
|
|
459 |
"bVisible": AllowCirculate ? true : false, |
567 |
"bVisible": AllowCirculate ? true : false, |
460 |
"mDataProp": function ( oObj ) { |
568 |
"mRender": mRenders.checkin, |
461 |
if ( oObj.can_renew_error == "on_reserve" ) { |
569 |
"bSortable": false |
462 |
return "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>"; |
|
|
463 |
} else { |
464 |
return "<input type='checkbox' class='checkin' id='checkin_" + oObj.itemnumber + "' name='checkin' value='" + oObj.itemnumber +"'></input>"; |
465 |
} |
466 |
} |
467 |
}, |
570 |
}, |
468 |
{ |
571 |
{ |
469 |
"bVisible": exports_enabled == 1 ? true : false, |
572 |
"bVisible": exports_enabled == 1 ? true : false, |
470 |
"bSortable": false, |
573 |
"bSortable": false, |
471 |
"mDataProp": function ( oObj ) { |
574 |
"mRender": mRenders.export |
472 |
var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />"; |
|
|
473 |
|
474 |
s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />"; |
475 |
return s; |
476 |
} |
477 |
} |
575 |
} |
478 |
], |
576 |
], |
479 |
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) { |
577 |
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) { |
Lines 488-544
$(document).ready(function() {
Link Here
|
488 |
$("#totaldue").html(total_charge.toFixed(2)); |
586 |
$("#totaldue").html(total_charge.toFixed(2)); |
489 |
$("#totalfine").html(total_fine.toFixed(2)); |
587 |
$("#totalfine").html(total_fine.toFixed(2)); |
490 |
$("#totalprice").html(total_price.toFixed(2)); |
588 |
$("#totalprice").html(total_price.toFixed(2)); |
491 |
}, |
|
|
492 |
"bPaginate": false, |
493 |
"bProcessing": true, |
494 |
"bServerSide": false, |
495 |
"sAjaxSource": '/cgi-bin/koha/svc/checkouts', |
496 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
497 |
aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); |
498 |
|
499 |
$.getJSON( sSource, aoData, function (json) { |
500 |
fnCallback(json) |
501 |
} ); |
502 |
}, |
503 |
"fnInitComplete": function(oSettings, json) { |
504 |
// Disable rowGrouping plugin after first use |
505 |
// so any sorting on the table doesn't use it |
506 |
var oSettings = issuesTable.fnSettings(); |
507 |
|
508 |
for (f = 0; f < oSettings.aoDrawCallback.length; f++) { |
509 |
if (oSettings.aoDrawCallback[f].sName == 'fnRowGrouping') { |
510 |
oSettings.aoDrawCallback.splice(f, 1); |
511 |
break; |
512 |
} |
513 |
} |
514 |
|
515 |
oSettings.aaSortingFixed = null; |
516 |
|
517 |
// Build a summary of checkouts grouped by itemtype |
518 |
var checkoutsByItype = json.aaData.reduce(function (obj, row) { |
519 |
obj[row.itemtype_description] = (obj[row.itemtype_description] || 0) + 1; |
520 |
return obj; |
521 |
}, {}); |
522 |
var ul = $('<ul>'); |
523 |
Object.keys(checkoutsByItype).sort().forEach(function (itype) { |
524 |
var li = $('<li>') |
525 |
.append($('<strong>').html(itype || MSG_NO_ITEMTYPE)) |
526 |
.append(': ' + checkoutsByItype[itype]); |
527 |
ul.append(li); |
528 |
}) |
529 |
$('<details>') |
530 |
.addClass('checkouts-by-itemtype') |
531 |
.append($('<summary>').html(MSG_CHECKOUTS_BY_ITEMTYPE)) |
532 |
.append(ul) |
533 |
.insertBefore(oSettings.nTableWrapper) |
534 |
}, |
535 |
}, columns_settings).rowGrouping( |
536 |
{ |
537 |
iGroupingColumnIndex: 1, |
538 |
iGroupingOrderByColumnIndex: 0, |
539 |
sGroupingColumnSortDirection: "asc" |
540 |
} |
589 |
} |
541 |
); |
590 |
}, columns_settings); |
|
|
591 |
|
592 |
enableGrouping(issuesTable); |
593 |
|
594 |
var groupingSwitch = $('<input type="checkbox">') |
595 |
.attr('id', 'issues-table-row-grouping-switch') |
596 |
.attr('checked', 'checked') |
597 |
.css('vertical-align', 'middle') |
598 |
.change(function() { |
599 |
if ($(this).is(':checked')) { |
600 |
enableGrouping(issuesTable); |
601 |
} else { |
602 |
disableGrouping(issuesTable); |
603 |
} |
604 |
}); |
605 |
$('<div></div>') |
606 |
.css('float', 'left') |
607 |
.css('padding', '0.3em 0.5em') |
608 |
.css('line-height', '1.9em') |
609 |
.append(groupingSwitch) |
610 |
.append(' ') |
611 |
.append('<label for="issues-table-row-grouping-switch">' + GROUP_TODAYS_CHECKOUTS + '</label>') |
612 |
.appendTo('#issues-table_wrapper .top.pager'); |
542 |
|
613 |
|
543 |
if ( $("#issues-table").length ) { |
614 |
if ( $("#issues-table").length ) { |
544 |
$("#issues-table_processing").position({ |
615 |
$("#issues-table_processing").position({ |
Lines 552-704
$(document).ready(function() {
Link Here
|
552 |
var relativesIssuesTable; |
623 |
var relativesIssuesTable; |
553 |
$("#relatives-issues-tab").click( function() { |
624 |
$("#relatives-issues-tab").click( function() { |
554 |
if ( ! relativesIssuesTable ) { |
625 |
if ( ! relativesIssuesTable ) { |
555 |
relativesIssuesTable = $("#relatives-issues-table").dataTable({ |
626 |
relativesIssuesTable = KohaTable("#relatives-issues-table", { |
556 |
"bAutoWidth": false, |
627 |
"bAutoWidth": false, |
557 |
"sDom": "rt", |
628 |
"sDom": 'C<"top pager"ilp>rt', |
558 |
"aaSorting": [], |
629 |
"aaSorting": [[4, "desc"]], |
|
|
630 |
"bProcessing": true, |
631 |
"bServerSide": ServerSideCheckoutsTables, |
632 |
"sAjaxSource": "/cgi-bin/koha/svc/checkouts", |
633 |
"fnServerParams": function (aoData) { |
634 |
for (i in relatives_borrowernumbers) { |
635 |
var borrowernumber = relatives_borrowernumbers[i]; |
636 |
aoData.push({ "name": "borrowernumber", "value": borrowernumber }); |
637 |
} |
638 |
}, |
639 |
"bPaginate": true, |
640 |
"sPaginationType": "four_button", |
559 |
"aoColumns": [ |
641 |
"aoColumns": [ |
560 |
{ |
642 |
{ |
561 |
"mDataProp": "date_due", |
643 |
"mData": "date_due", |
562 |
"bVisible": false, |
644 |
"mRender": mRenders.dateDueFormatted |
563 |
}, |
645 |
}, |
564 |
{ |
646 |
{ |
565 |
"iDataSort": 1, // Sort on hidden unformatted date due column |
647 |
"mData": "title", |
566 |
"mDataProp": function( oObj ) { |
648 |
"mRender": mRenders.title, |
567 |
var today = new Date(); |
|
|
568 |
var due = new Date( oObj.date_due ); |
569 |
if ( today > due ) { |
570 |
return "<span class='overdue'>" + oObj.date_due_formatted + "</span>"; |
571 |
} else { |
572 |
return oObj.date_due_formatted; |
573 |
} |
574 |
} |
575 |
}, |
649 |
}, |
576 |
{ |
650 |
{ |
577 |
"mDataProp": function ( oObj ) { |
651 |
"mData": "itemtype", |
578 |
title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" |
652 |
"mRender": mRenders.itemtype |
579 |
+ oObj.biblionumber |
|
|
580 |
+ "'>" |
581 |
+ oObj.title.escapeHtml(); |
582 |
|
583 |
$.each(oObj.subtitle, function( index, value ) { |
584 |
title += " " + value.subfield.escapeHtml(); |
585 |
}); |
586 |
|
587 |
if ( oObj.enumchron ) { |
588 |
title += " (" + oObj.enumchron.escapeHtml() + ")"; |
589 |
} |
590 |
|
591 |
title += "</a></span>"; |
592 |
|
593 |
if ( oObj.author ) { |
594 |
title += " " + BY.replace( "_AUTHOR_", " " + oObj.author.escapeHtml() ); |
595 |
} |
596 |
|
597 |
if ( oObj.itemnotes ) { |
598 |
var span_class = ""; |
599 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
600 |
span_class = "circ-hlt"; |
601 |
} |
602 |
title += " - <span class='" + span_class + "'>" + oObj.itemnotes.escapeHtml() + "</span>" |
603 |
} |
604 |
|
605 |
if ( oObj.itemnotes_nonpublic ) { |
606 |
var span_class = ""; |
607 |
if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) { |
608 |
span_class = "circ-hlt"; |
609 |
} |
610 |
title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic.escapeHtml() + "</span>" |
611 |
} |
612 |
|
613 |
var onsite_checkout = ''; |
614 |
if ( oObj.onsite_checkout == 1 ) { |
615 |
onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>"; |
616 |
} |
617 |
|
618 |
title += " " |
619 |
+ "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=" |
620 |
+ oObj.biblionumber |
621 |
+ "&itemnumber=" |
622 |
+ oObj.itemnumber |
623 |
+ "#" |
624 |
+ oObj.itemnumber |
625 |
+ "'>" |
626 |
+ oObj.barcode.escapeHtml() |
627 |
+ "</a>" |
628 |
+ onsite_checkout; |
629 |
|
630 |
return title; |
631 |
}, |
632 |
"sType": "anti-the" |
633 |
}, |
653 |
}, |
634 |
{ |
654 |
{ |
635 |
"mDataProp": function ( oObj ) { |
655 |
"mData": "ccode", |
636 |
return oObj.itemtype_description.escapeHtml(); |
656 |
"mRender": mRenders.collection |
637 |
} |
|
|
638 |
}, |
657 |
}, |
639 |
{ |
658 |
{ |
640 |
"mDataProp": function ( oObj ) { |
659 |
"mData": "location", |
641 |
return oObj.collection.escapeHtml(); |
660 |
"mRender": mRenders.location |
642 |
} |
|
|
643 |
}, |
661 |
}, |
644 |
{ |
662 |
{ |
645 |
"mDataProp": function ( oObj ) { |
663 |
"mData": "issuedate", |
646 |
return oObj.location.escapeHtml(); |
664 |
"mRender": mRenders.issuedate |
647 |
} |
|
|
648 |
}, |
665 |
}, |
649 |
{ "mDataProp": "issuedate_formatted" }, |
|
|
650 |
{ |
666 |
{ |
651 |
"mDataProp": function ( oObj ) { |
667 |
"mData": "branchcode", |
652 |
return oObj.branchname.escapeHtml(); |
668 |
"mRender": mRenders.branch |
653 |
} |
|
|
654 |
}, |
669 |
}, |
655 |
{ |
670 |
{ |
656 |
"mDataProp": function ( oObj ) { |
671 |
"mData": "itemcallnumber", |
657 |
return oObj.itemcallnumber.escapeHtml(); |
672 |
"mRender": mRenders.itemcallnumber |
658 |
} |
|
|
659 |
}, |
673 |
}, |
660 |
{ |
674 |
{ |
661 |
"mDataProp": function ( oObj ) { |
675 |
"mData": "charge", |
662 |
if ( ! oObj.charge ) oObj.charge = 0; |
676 |
"mRender": mRenders.charge, |
663 |
return parseFloat(oObj.charge).toFixed(2); |
677 |
"bSortable": ServerSideCheckoutsTables ? false : true |
664 |
} |
|
|
665 |
}, |
678 |
}, |
666 |
{ |
679 |
{ |
667 |
"mDataProp": function ( oObj ) { |
680 |
"mData": "fine", |
668 |
if ( ! oObj.fine ) oObj.fine = 0; |
681 |
"mRender": mRenders.fine, |
669 |
return parseFloat(oObj.fine).toFixed(2); |
682 |
"bSortable": ServerSideCheckoutsTables ? false : true |
670 |
} |
|
|
671 |
}, |
683 |
}, |
672 |
{ |
684 |
{ |
673 |
"mDataProp": function ( oObj ) { |
685 |
"mData": "replacementprice", |
674 |
if ( ! oObj.price ) oObj.price = 0; |
686 |
"mRender": mRenders.price, |
675 |
return parseFloat(oObj.price).toFixed(2); |
687 |
"bSortable": ServerSideCheckoutsTables ? false : true |
676 |
} |
|
|
677 |
}, |
688 |
}, |
678 |
{ |
689 |
{ |
679 |
"mDataProp": function( oObj ) { |
690 |
"mData": "borrowernumber", |
680 |
return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>" |
691 |
"mRender": mRenders.patron, |
681 |
+ oObj.borrower.firstname.escapeHtml() |
692 |
"bSortable": ServerSideCheckoutsTables ? false : true |
682 |
+ " " + |
693 |
} |
683 |
oObj.borrower.surname.escapeHtml() |
694 |
] |
684 |
+ " (" + oObj.borrower.cardnumber.escapeHtml() + ")</a>" |
695 |
}, relatives_columns_settings); |
685 |
} |
|
|
686 |
}, |
687 |
], |
688 |
"bPaginate": false, |
689 |
"bProcessing": true, |
690 |
"bServerSide": false, |
691 |
"sAjaxSource": '/cgi-bin/koha/svc/checkouts', |
692 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
693 |
$.each(relatives_borrowernumbers, function( index, value ) { |
694 |
aoData.push( { "name": "borrowernumber", "value": value } ); |
695 |
}); |
696 |
|
697 |
$.getJSON( sSource, aoData, function (json) { |
698 |
fnCallback(json) |
699 |
} ); |
700 |
}, |
701 |
}); |
702 |
} |
696 |
} |
703 |
}); |
697 |
}); |
704 |
|
698 |
|
Lines 718-721
$(document).ready(function() {
Link Here
|
718 |
} |
712 |
} |
719 |
} ).prop('checked', false); |
713 |
} ).prop('checked', false); |
720 |
} |
714 |
} |
721 |
}); |
715 |
}); |
|
|
716 |
|
717 |
})(jQuery); |