Bug 9302: Use new 'edit borrowers' permission
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / checkouts.js
blobd6cd4b8fb4ff8252b10901b58839ba9c704bdfd4
1 $(document).ready(function() {
2     $.ajaxSetup ({ cache: false });
4     var barcodefield = $("#barcode");
6     // Handle the select all/none links for checkouts table columns
7     $("#CheckAllRenewals").on("click",function(){
8         $("#UncheckAllCheckins").click();
9         $(".renew:visible").prop("checked", true);
10         return false;
11     });
12     $("#UncheckAllRenewals").on("click",function(){
13         $(".renew:visible").prop("checked", false);
14         return false;
15     });
17     $("#CheckAllCheckins").on("click",function(){
18         $("#UncheckAllRenewals").click();
19         $(".checkin:visible").prop("checked", true);
20         return false;
21     });
22     $("#UncheckAllCheckins").on("click",function(){
23         $(".checkin:visible").prop("checked", false);
24         return false;
25     });
27     // Don't allow both return and renew checkboxes to be checked
28     $(document).on("change", '.renew', function(){
29         if ( $(this).is(":checked") ) {
30             $( "#checkin_" + $(this).val() ).prop("checked", false);
31         }
32     });
33     $(document).on("change", '.checkin', function(){
34         if ( $(this).is(":checked") ) {
35             $( "#renew_" + $(this).val() ).prop("checked", false);
36         }
37     });
39     $("#output_format > option:first-child").attr("selected", "selected");
40     $("select[name='csv_profile_id']").hide();
41     $(document).on("change", '#issues-table-output-format', function(){
42         if ( $(this).val() == 'csv' ) {
43             $("select[name='csv_profile_id']").show();
44         } else {
45             $("select[name='csv_profile_id']").hide();
46         }
47     });
49     // Clicking the table cell checks the checkbox inside it
50     $(document).on("click", 'td', function(e){
51         if(e.target.tagName.toLowerCase() == 'td'){
52           $(this).find("input:checkbox:visible").each( function() {
53             $(this).click();
54           });
55         }
56     });
58     // Handle renewals and returns
59     $("#RenewCheckinChecked").on("click",function(){
60         $(".checkin:checked:visible").each(function() {
61             itemnumber = $(this).val();
63             $(this).replaceWith("<img id='checkin_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
65             params = {
66                 itemnumber:     itemnumber,
67                 borrowernumber: borrowernumber,
68                 branchcode:     branchcode,
69                 exempt_fine:    $("#exemptfine").is(':checked')
70             };
72             $.post( "/cgi-bin/koha/svc/checkin", params, function( data ) {
73                 id = "#checkin_" + data.itemnumber;
75                 content = "";
76                 if ( data.returned ) {
77                     content = CIRCULATION_RETURNED;
78                     $(id).parent().parent().addClass('ok');
79                     $('#date_due_' + data.itemnumber).html(CIRCULATION_RETURNED);
80                     if ( data.patronnote != null ) {
81                         $('.patron_note_' + data.itemnumber).html("Patron note: " + data.patronnote);
82                     }
83                 } else {
84                     content = CIRCULATION_NOT_RETURNED;
85                     $(id).parent().parent().addClass('warn');
86                 }
88                 $(id).replaceWith( content );
89             }, "json")
90         });
92         $(".renew:checked:visible").each(function() {
93             var override_limit = $("#override_limit").is(':checked') ? 1 : 0;
95             var itemnumber = $(this).val();
97             $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />");
99             var params = {
100                 itemnumber:     itemnumber,
101                 borrowernumber: borrowernumber,
102                 branchcode:     branchcode,
103                 override_limit: override_limit,
104                 date_due:       $("#newduedate").val()
105             };
107             $.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
108                 var id = "#renew_" + data.itemnumber;
110                 var content = "";
111                 if ( data.renew_okay ) {
112                     content = CIRCULATION_RENEWED_DUE + " " + data.date_due;
113                     $('#date_due_' + data.itemnumber).replaceWith( data.date_due );
114                 } else {
115                     content = CIRCULATION_RENEW_FAILED + " ";
116                     if ( data.error == "no_checkout" ) {
117                         content += NOT_CHECKED_OUT;
118                     } else if ( data.error == "too_many" ) {
119                         content += TOO_MANY_RENEWALS;
120                     } else if ( data.error == "on_reserve" ) {
121                         content += ON_RESERVE;
122                     } else if ( data.error == "restriction" ) {
123                         content += NOT_RENEWABLE_RESTRICTION;
124                     } else if ( data.error == "overdue" ) {
125                         content += NOT_RENEWABLE_OVERDUE;
126                     } else if ( data.error ) {
127                         content += data.error;
128                     } else {
129                         content += REASON_UNKNOWN;
130                     }
131                 }
133                 $(id).replaceWith( content );
134             }, "json")
135         });
137         // Refocus on barcode field if it exists
138         if ( $("#barcode").length ) {
139             $("#barcode").focus();
140         }
142         // Prevent form submit
143         return false;
144     });
146     $("#RenewAll").on("click",function(){
147         $("#CheckAllRenewals").click();
148         $("#UncheckAllCheckins").click();
149         $("#RenewCheckinChecked").click();
151         // Prevent form submit
152         return false;
153     });
155     var ymd = $.datepicker.formatDate('yy-mm-dd', new Date());
157     $('#issues-table').hide();
158     $('#issues-table-actions').hide();
159     $('#issues-table-load-immediately').change(function(){
160         if ( this.checked && typeof issuesTable === 'undefined') {
161             $('#issues-table-load-now-button').click();
162         }
163         barcodefield.focus();
164     });
165     $('#issues-table-load-now-button').click(function(){
166         LoadIssuesTable();
167         barcodefield.focus();
168         return false;
169     });
171     if ( $.cookie("issues-table-load-immediately-" + script) == "true" ) {
172         LoadIssuesTable();
173         $('#issues-table-load-immediately').prop('checked', true);
174     }
175     $('#issues-table-load-immediately').on( "change", function(){
176         $.cookie("issues-table-load-immediately-" + script, $(this).is(':checked'), { expires: 365 });
177     });
179     function LoadIssuesTable() {
180         $('#issues-table-loading-message').hide();
181         $('#issues-table').show();
182         $('#issues-table-actions').show();
184         issuesTable = KohaTable("issues-table", {
185             "oLanguage": {
186                 "sEmptyTable" : MSG_DT_LOADING_RECORDS,
187                 "sProcessing": MSG_DT_LOADING_RECORDS,
188             },
189             "bAutoWidth": false,
190             "dom": 'B<"clearfix">rt',
191             "aoColumns": [
192                 {
193                     "mDataProp": function( oObj ) {
194                         return oObj.sort_order;
195                     }
196                 },
197                 {
198                     "mDataProp": function( oObj ) {
199                         if ( oObj.issued_today ) {
200                             return "<strong>" + TODAYS_CHECKOUTS + "</strong>";
201                         } else {
202                             return "<strong>" + PREVIOUS_CHECKOUTS + "</strong>";
203                         }
204                     }
205                 },
206                 {
207                     "mDataProp": "date_due",
208                     "bVisible": false,
209                 },
210                 {
211                     "iDataSort": 2, // Sort on hidden unformatted date due column
212                     "mDataProp": function( oObj ) {
213                         var due = oObj.date_due_formatted;
215                         if ( oObj.date_due_overdue ) {
216                             due = "<span class='overdue'>" + due + "</span>";
217                         }
219                         due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>";
221                         if ( oObj.lost ) {
222                             due += "<span class='lost'>" + oObj.lost + "</span>";
223                         }
225                         if ( oObj.damaged ) {
226                             due += "<span class='dmg'>" + oObj.damaged + "</span>";
227                         }
229                         var patron_note = " <span class='patron_note_" + oObj.itemnumber + "'></span>";
230                         due +="<br>" + patron_note;
232                         return due;
233                     }
234                 },
235                 {
236                     "mDataProp": function ( oObj ) {
237                         title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
238                               + oObj.biblionumber
239                               + "'>"
240                               + oObj.title;
242                         $.each(oObj.subtitle, function( index, value ) {
243                                   title += " " + value.subfield;
244                         });
246                         if ( oObj.enumchron ) {
247                             title += " (" + oObj.enumchron + ")";
248                         }
250                         title += "</a></span>";
252                         if ( oObj.author ) {
253                             title += " " + BY.replace( "_AUTHOR_",  " " + oObj.author );
254                         }
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                         }
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                         }
272                         var onsite_checkout = '';
273                         if ( oObj.onsite_checkout == 1 ) {
274                             onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
275                         }
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
289                         return title;
290                     },
291                     "sType": "anti-the"
292                 },
293                 { "mDataProp": "itemtype_description" },
294                 { "mDataProp": "location" },
295                 { "mDataProp": "homebranch" },
296                 { "mDataProp": "issuedate_formatted" },
297                 { "mDataProp": "branchname" },
298                 { "mDataProp": "itemcallnumber" },
299                 {
300                     "mDataProp": function ( oObj ) {
301                         if ( ! oObj.charge ) oObj.charge = 0;
302                         return '<span style="text-align: right; display: block;">' + parseFloat(oObj.charge).toFixed(2) + '<span>';
303                     }
304                 },
305                 {
306                     "mDataProp": function ( oObj ) {
307                         if ( ! oObj.fine ) oObj.fine = 0;
308                         return '<span style="text-align: right; display: block;">' + parseFloat(oObj.fine).toFixed(2)  + '<span>';
309                     }
310                 },
311                 {
312                     "mDataProp": function ( oObj ) {
313                         if ( ! oObj.price ) oObj.price = 0;
314                         return '<span style="text-align: right; display: block;">' + parseFloat(oObj.price).toFixed(2) + '<span>';
315                     }
316                 },
317                 {
318                     "bSortable": false,
319                     "bVisible": AllowCirculate ? true : false,
320                     "mDataProp": function ( oObj ) {
321                         var content = "";
322                         var span_style = "";
323                         var span_class = "";
325                         content += "<span>";
326                         content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>";
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>";
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>";
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>";
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>";
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>";
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>";
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>";
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>";
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>";
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>";
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>";
407                             span_style = "display: none";
408                             span_class = "renewals-allowed";
409                         }
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>";
422                             content += "<span class='renewals'>("
423                                     + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
424                                     + ")</span>";
425                         }
427                         content += "</span>";
429                         return content;
430                     }
431                 },
432                 {
433                     "bSortable": false,
434                     "bVisible": AllowCirculate ? true : false,
435                     "mDataProp": function ( oObj ) {
436                         if ( oObj.can_renew_error == "on_reserve" ) {
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                 },
443                 {
444                     "bVisible": exports_enabled == 1 ? true : false,
445                     "bSortable": false,
446                     "mDataProp": function ( oObj ) {
447                         var s = "<input type='checkbox' name='itemnumbers' value='" + oObj.itemnumber + "' style='visibility:hidden;' />";
449                         s += "<input type='checkbox' class='export' id='export_" + oObj.biblionumber + "' name='biblionumbers' value='" + oObj.biblionumber + "' />";
450                         return s;
451                     }
452                 }
453             ],
454             "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
455                 var total_charge = 0;
456                 var total_fine  = 0;
457                 var total_price = 0;
458                 for ( var i=0; i < aaData.length; i++ ) {
459                     total_charge += aaData[i]['charge'] * 1;
460                     total_fine += aaData[i]['fine'] * 1;
461                     total_price  += aaData[i]['price'] * 1;
462                 }
463                 $("#totaldue").html(total_charge.toFixed(2));
464                 $("#totalfine").html(total_fine.toFixed(2));
465                 $("#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 } );
474                 $.getJSON( sSource, aoData, function (json) {
475                     fnCallback(json)
476                 } );
477             },
478             "fnInitComplete": function(oSettings, json) {
479                 // Disable rowGrouping plugin after first use
480                 // so any sorting on the table doesn't use it
481                 var oSettings = issuesTable.fnSettings();
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                 }
490                 oSettings.aaSortingFixed = null;
492                 // Build a summary of checkouts grouped by itemtype
493                 var checkoutsByItype = json.aaData.reduce(function (obj, row) {
494                     obj[row.itemtype_description] = (obj[row.itemtype_description] || 0) + 1;
495                     return obj;
496                 }, {});
497                 var ul = $('<ul>');
498                 Object.keys(checkoutsByItype).sort().forEach(function (itype) {
499                     var li = $('<li>')
500                         .append($('<strong>').html(itype || MSG_NO_ITEMTYPE))
501                         .append(': ' + checkoutsByItype[itype]);
502                     ul.append(li);
503                 })
504                 $('<details>')
505                     .addClass('checkouts-by-itemtype')
506                     .append($('<summary>').html(MSG_CHECKOUTS_BY_ITEMTYPE))
507                     .append(ul)
508                     .insertBefore(oSettings.nTableWrapper)
509             },
510         }, columns_settings).rowGrouping(
511             {
512                 iGroupingColumnIndex: 1,
513                 iGroupingOrderByColumnIndex: 0,
514                 sGroupingColumnSortDirection: "asc"
515             }
516         );
518         if ( $("#issues-table").length ) {
519             $("#issues-table_processing").position({
520                 of: $( "#issues-table" ),
521                 collision: "none"
522             });
523         }
524     }
526     // Don't load relatives' issues table unless it is clicked on
527     var relativesIssuesTable;
528     $("#relatives-issues-tab").click( function() {
529         if ( ! relativesIssuesTable ) {
530             relativesIssuesTable = $("#relatives-issues-table").dataTable({
531                 "bAutoWidth": false,
532                 "sDom": "rt",
533                 "aaSorting": [],
534                 "aoColumns": [
535                     {
536                         "mDataProp": "date_due",
537                         "bVisible": false,
538                     },
539                     {
540                         "iDataSort": 1, // Sort on hidden unformatted date due column
541                         "mDataProp": function( oObj ) {
542                             var today = new Date();
543                             var due = new Date( oObj.date_due );
544                             if ( today > due ) {
545                                 return "<span class='overdue'>" + oObj.date_due_formatted + "</span>";
546                             } else {
547                                 return oObj.date_due_formatted;
548                             }
549                         }
550                     },
551                     {
552                         "mDataProp": function ( oObj ) {
553                             title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
554                                   + oObj.biblionumber
555                                   + "'>"
556                                   + oObj.title;
558                             $.each(oObj.subtitle, function( index, value ) {
559                                       title += " " + value.subfield;
560                             });
562                             if ( oObj.enumchron ) {
563                                 title += " (" + oObj.enumchron + ")";
564                             }
566                             title += "</a></span>";
568                             if ( oObj.author ) {
569                                 title += " " + BY.replace( "_AUTHOR_", " " + oObj.author );
570                             }
572                             if ( oObj.itemnotes ) {
573                                 var span_class = "";
574                                 if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
575                                     span_class = "circ-hlt";
576                                 }
577                                 title += " - <span class='" + span_class + "'>" + oObj.itemnotes + "</span>"
578                             }
580                             if ( oObj.itemnotes_nonpublic ) {
581                                 var span_class = "";
582                                 if ( $.datepicker.formatDate('yy-mm-dd', new Date(oObj.issuedate) ) == ymd ) {
583                                     span_class = "circ-hlt";
584                                 }
585                                 title += " - <span class='" + span_class + "'>" + oObj.itemnotes_nonpublic + "</span>"
586                             }
588                             var onsite_checkout = '';
589                             if ( oObj.onsite_checkout == 1 ) {
590                                 onsite_checkout += " <span class='onsite_checkout'>(" + INHOUSE_USE + ")</span>";
591                             }
593                             title += " "
594                                   + "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber="
595                                   + oObj.biblionumber
596                                   + "&itemnumber="
597                                   + oObj.itemnumber
598                                   + "#"
599                                   + oObj.itemnumber
600                                   + "'>"
601                                   + oObj.barcode
602                                   + "</a>"
603                                   + onsite_checkout;
605                             return title;
606                         },
607                         "sType": "anti-the"
608                     },
609                     { "mDataProp": "itemtype" },
610                     { "mDataProp": "location" },
611                     { "mDataProp": "issuedate_formatted" },
612                     { "mDataProp": "branchname" },
613                     { "mDataProp": "itemcallnumber" },
614                     {
615                         "mDataProp": function ( oObj ) {
616                             if ( ! oObj.charge ) oObj.charge = 0;
617                             return parseFloat(oObj.charge).toFixed(2);
618                         }
619                     },
620                     {
621                         "mDataProp": function ( oObj ) {
622                             if ( ! oObj.fine ) oObj.fine = 0;
623                             return parseFloat(oObj.fine).toFixed(2);
624                         }
625                     },
626                     {
627                         "mDataProp": function ( oObj ) {
628                             if ( ! oObj.price ) oObj.price = 0;
629                             return parseFloat(oObj.price).toFixed(2);
630                         }
631                     },
632                     {
633                         "mDataProp": function( oObj ) {
634                             return "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=" + oObj.borrowernumber + "'>"
635                                  + oObj.borrower.firstname + " " + oObj.borrower.surname + " (" + oObj.borrower.cardnumber + ")</a>"
636                         }
637                     },
638                 ],
639                 "bPaginate": false,
640                 "bProcessing": true,
641                 "bServerSide": false,
642                 "sAjaxSource": '/cgi-bin/koha/svc/checkouts',
643                 "fnServerData": function ( sSource, aoData, fnCallback ) {
644                     $.each(relatives_borrowernumbers, function( index, value ) {
645                         aoData.push( { "name": "borrowernumber", "value": value } );
646                     });
648                     $.getJSON( sSource, aoData, function (json) {
649                         fnCallback(json)
650                     } );
651                 },
652             });
653         }
654     });
656     if ( $("#relatives-issues-table").length ) {
657         $("#relatives-issues-table_processing").position({
658             of: $( "#relatives-issues-table" ),
659             collision: "none"
660         });
661     }
663     if ( AllowRenewalLimitOverride ) {
664         $( '#override_limit' ).click( function () {
665             if ( this.checked ) {
666                 $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
667             } else {
668                 $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
669             }
670         } ).prop('checked', false);
671     }
672  });