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