@@ -, +, @@ - Tabs should work. - Showing and hiding the "Add message" form should work. - The "specify due date" datepicker should work. - Controls for selecting checkboxes in the checkouts table should work - With checkout exports enabled, warnings should be displayed if you have no checkouts selected, or if you try to export as CSV and have no CSV profile specified in your ExportWithCsvProfile. --- .../intranet-tmpl/prog/en/js/pages/circulation.js | 144 ++++++++++++++++++ .../prog/en/modules/circ/circulation.tt | 153 +------------------- 2 files changed, 152 insertions(+), 145 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js +++ a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js @@ -0,0 +1,144 @@ +$(document).ready(function() { + $('#patronlists').tabs(); + var allcheckboxes = $(".checkboxed"); + $("#renew_all").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=items]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); + }); + $("#CheckAllitems").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=items]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; + }); + $("#CheckNoitems").click(function(){ + $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; + }); + $("#CheckAllreturns").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; + }); + $("#CheckNoreturns" ).click(function(){ + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; + }); + + $("#CheckAllexports").click(function(){ + $(".checkboxed").checkCheckboxes(":input[name*=biblionumbers]"); + $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); + return false; + }); + $("#CheckNoexports").click(function(){ + $(".checkboxed").unCheckCheckboxes(":input[name*=biblionumbers]"); + return false; + }); + + $("#relrenew_all").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=items]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); + }); + $("#relCheckAllitems").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=items]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; + }); + $("#relCheckNoitems").click(function(){ + $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; + }); + $("#relCheckAllreturns").click(function(){ + $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]"); + $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; + }); + $("#relCheckNoreturns").click(function(){ + $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; + }); + $("#messages ul").after(""+MSG_ADD_MESSAGE+""); + $("#borrower_messages .cancel").click(function(){ + $("#add_message_form").hide(); + $("#addmessage").show(); + }); + $("#addmessage").click(function (){ + $(this).hide(); + $("#add_message_form").show(); + }); + + $("input.radio").click(function(){ + radioCheckBox($(this)); + }); + + $("#newduedate").datetimepicker({ + minDate: 1, // require that renewal date is after today + hour: 23, + minute: 59 + }); + $("#duedatespec").datetimepicker({ + onClose: function(dateText, inst) { $("#barcode").focus(); }, + hour: 23, + minute: 59 + }); + $("#export_submit").click(function(){ + var export_format = $("#export_formats").val(); + export_checkouts(export_format); + return false; + }); + // Clicking the table cell checks the checkbox inside it + $("td").click(function(e){ + if(e.target.tagName.toLowerCase() == 'td'){ + $(this).find("input:checkbox:visible").each( function() { + if($(this).attr("checked")){ + $(this).removeAttr("checked"); + } else { + $(this).attr("checked","checked"); + radioCheckBox($(this)); + } + }); + } + }); +}); + +function export_checkouts(format) { + if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){ + alert(MSG_EXPORT_SELECT_CHECKOUTS); + return; + } + + $("input:checkbox[name='biblionumbers']").each( function(){ + var input_item = $(this).siblings("input:checkbox"); + if ( $(this).is(":checked") ) { + $(input_item).attr("checked", "checked"); + } else { + $(input_item).attr("checked", ""); + } + } ); + + if (format == 'iso2709_995') { + format = 'iso2709'; + $("#dont_export_item").val(0); + } else if (format == 'iso2709') { + $("#dont_export_item").val(1); + } else if (format === '') { + alert(MSG_EXPORT_DEFINE_CSV_FORMAT); + return false; + } + document.issues.action="/cgi-bin/koha/tools/export.pl"; + document.getElementById("export_format").value = format; + document.issues.submit(); + + /* Reset form action to its initial value */ + document.issues.action="/cgi-bin/koha/reserve/renewscript.pl"; + +} + +function validate1(date) { + var today = new Date(); + if ( date < today ) { + return true; + } else { + return false; + } +} + +// prevent adjacent checkboxes from being checked simultaneously +function radioCheckBox(box){ + box.parents("td").siblings().find("input:checkbox:visible").each(function(){ + if($(this).attr("checked")){ + $(this).removeAttr("checked"); + } + }); + } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -11,8 +11,12 @@ [% IF ( UseTablesortForCirc ) %][% END %] + @@ -949,7 +808,11 @@ No patron matched [% message %] --