From 410d1fdd21f0c45aeb25ce1aa9ed88844b4a62a1 Mon Sep 17 00:00:00 2001 From: Julian Maurice <julian.maurice@biblibre.com> Date: Sat, 9 Apr 2016 07:58:42 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 16238: Use .prop() instead of .attr() for 'checked' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" According to https://jquery.com/upgrade-guide/1.9/#attr-versus-prop- .attr() is no longer correct to access the checked state of a checkbox. This patch do the following replacements: .attr('checked') => .prop('checked') .attr('checked, '') => .prop('checked', false) .attr('checked, 'checked') => .prop('checked', true) .attr('checked', boolValue) => .prop('checked', boolValue) .removeAttr('checked') => .prop('checked', false) .attr('checked') == 'checked' => .is(':checked') Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Owen Leonard <oleonard@myacpl.org> --- .../prog/en/includes/messaging-preference-form.inc | 30 +++++++++++----------- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 8 +++--- koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js | 14 +++++----- .../prog/en/js/marc_subfields_structure.js | 12 ++++----- koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js | 12 ++++----- .../intranet-tmpl/prog/en/js/pages/batchMod.js | 16 ++++++------ .../intranet-tmpl/prog/en/js/pages/circulation.js | 10 ++++---- .../prog/en/modules/acqui/addorderiso2709.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 2 +- .../prog/en/modules/acqui/invoices.tt | 4 +-- .../prog/en/modules/acqui/newordersubscription.tt | 2 +- .../prog/en/modules/acqui/orderreceive.tt | 4 +-- .../prog/en/modules/acqui/supplier.tt | 14 +++++----- .../intranet-tmpl/prog/en/modules/admin/aqplan.tt | 2 +- .../prog/en/modules/admin/currency.tt | 2 +- .../prog/en/modules/admin/smart-rules.tt | 4 +-- .../prog/en/modules/catalogue/detail.tt | 4 +-- .../prog/en/modules/catalogue/results.tt | 4 +-- .../prog/en/modules/cataloguing/merge.tt | 4 +-- .../prog/en/modules/circ/circulation.tt | 4 +-- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 2 +- .../prog/en/modules/members/member-flags.tt | 4 +-- .../prog/en/modules/members/memberentrygen.tt | 8 +++--- .../prog/en/modules/patroncards/edit-layout.tt | 12 ++++----- .../prog/en/modules/reports/catalogue_stats.tt | 2 +- .../en/modules/reports/guided_reports_start.tt | 12 ++++----- .../prog/en/modules/reserve/request.tt | 8 +++--- .../prog/en/modules/serials/claims.tt | 2 +- .../en/modules/serials/showpredictionpattern.tt | 6 ++--- .../prog/en/modules/tools/batch_delete_records.tt | 2 +- .../prog/en/modules/tools/modborrowers.tt | 4 +-- 32 files changed, 109 insertions(+), 109 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc index dabad6d..b4405b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -3,14 +3,14 @@ <script type="text/javascript">//<![CDATA[ $(document).ready(function(){ $(".none").click(function(){ - if($(this).attr("checked")){ + if($(this).prop("checked")){ var rowid = $(this).attr("id"); newid = Number(rowid.replace("none","")) - $("#sms"+newid).removeAttr("checked"); - $("#email"+newid).removeAttr("checked"); - $("#phone"+newid).removeAttr("checked"); - $("#digest"+newid).removeAttr("checked"); - $("#rss"+newid).removeAttr("checked"); + $("#sms"+newid).prop("checked", false); + $("#email"+newid).prop("checked", false); + $("#phone"+newid).prop("checked", false); + $("#digest"+newid).prop("checked", false); + $("#rss"+newid).prop("checked", false); } }); $("#info_digests").tooltip(); @@ -75,12 +75,12 @@ <input type="checkbox" id="sms[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="sms" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="sms" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% ELSE %] <input type="checkbox" id="sms[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="sms" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="sms" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% END %] [% END %] </td>[% END %] @@ -103,12 +103,12 @@ <input type="checkbox" id="phone[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="phone" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="phone" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% ELSE %] <input type="checkbox" id="phone[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="phone" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="phone" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% END %] [% END %] </td>[% END %] @@ -132,12 +132,12 @@ <input type="checkbox" id="email[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="email" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="email" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% ELSE %] <input type="checkbox" id="email[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="email" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="email" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% END %] [% END %] </td> @@ -164,12 +164,12 @@ <input type="checkbox" id="digest[% messaging_preference.message_attribute_id %]" value="[% messaging_preference.message_attribute_id %]" - name="digest" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + name="digest" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% ELSE %] <input type="checkbox" id="digest[% messaging_preference.message_attribute_id %]" value="[% messaging_preference.message_attribute_id %]" - name="digest" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + name="digest" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% END %] [% END %] </td> @@ -188,7 +188,7 @@ <input type="checkbox" id="rss[% messaging_preference.message_attribute_id %]" name="[% messaging_preference.message_attribute_id %]" - value="rss" [% messaging_preference.transport_rss %] onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" /> + value="rss" [% messaging_preference.transport_rss %] onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" /> [% END %] </td> [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index ddd95bc..9d3983c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -345,7 +345,7 @@ function checkBudgetParent(budgetId, newBudgetParent) { } function hideColumn(num) { - $("#hideall,#showall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall,#showall").prop("checked", false).parent().removeClass("selected"); $("#"+num).parent().removeClass("selected"); var hide = Number(num.replace("col","")) + 2; // hide header and cells matching the index @@ -353,7 +353,7 @@ function hideColumn(num) { } function showColumn(num){ - $("#hideall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall").prop("checked", false).parent().removeClass("selected"); $("#"+num).parent().addClass("selected"); // set the index of the table column to hide show = Number(num.replace("col","")) + 2; @@ -365,12 +365,12 @@ function showAllColumns(){ $("#selections").checkCheckboxes(); $("#selections span").addClass("selected"); $("#plan td:nth-child(2),#plan tr th:nth-child(2)").nextAll().show(); - $("#hideall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall").prop("checked", false).parent().removeClass("selected"); } function hideAllColumns(){ var allCols = $("#plan th").length; $("#selections").unCheckCheckboxes(); $("#selections span").removeClass("selected"); $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns - $("#hideall").attr("checked","checked").parent().addClass("selected"); + $("#hideall").prop("checked", true).parent().addClass("selected"); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js index 5137b7d..bf419d7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js @@ -6,33 +6,33 @@ $(document).ready(function() { // Handle the select all/none links for checkouts table columns $("#CheckAllRenewals").on("click",function(){ $("#UncheckAllCheckins").click(); - $(".renew:visible").attr("checked", "checked" ); + $(".renew:visible").prop("checked", true); return false; }); $("#UncheckAllRenewals").on("click",function(){ - $(".renew:visible").removeAttr("checked"); + $(".renew:visible").prop("checked", false); return false; }); $("#CheckAllCheckins").on("click",function(){ $("#UncheckAllRenewals").click(); - $(".checkin:visible").attr("checked", "checked" ); + $(".checkin:visible").prop("checked", true); return false; }); $("#UncheckAllCheckins").on("click",function(){ - $(".checkin:visible").removeAttr("checked"); + $(".checkin:visible").prop("checked", false); return false; }); // Don't allow both return and renew checkboxes to be checked $(document).on("change", '.renew', function(){ if ( $(this).is(":checked") ) { - $( "#checkin_" + $(this).val() ).removeAttr("checked"); + $( "#checkin_" + $(this).val() ).prop("checked", false); } }); $(document).on("change", '.checkin', function(){ if ( $(this).is(":checked") ) { - $( "#renew_" + $(this).val() ).removeAttr("checked"); + $( "#renew_" + $(this).val() ).prop("checked", false); } }); @@ -603,6 +603,6 @@ $(document).ready(function() { } else { $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show(); } - } ).attr( 'checked', false ); + } ).prop('checked', false); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js index ce50e67..2745564 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js @@ -11,7 +11,7 @@ $(document).ready(function() { /* Function to enable/disable hidden values checkboxes when Flag is (de)selected */ function enable_cb(tab) { if ($("#hidden_flagged_" + tab).is(':checked')) { - $('.inclusive_' + tab).attr('disabled',true).removeAttr('checked'); + $('.inclusive_' + tab).attr('disabled',true).prop('checked', false); } else { $('.inclusive_' + tab).removeAttr('disabled'); @@ -132,11 +132,11 @@ function populateHiddenCheckboxes(tab) { collapsed_checked = true; } // else if ( hidden_value == '8') { skip } - $("#hidden_opac_" + tab).attr('checked',opac_checked); - $("#hidden_intranet_" + tab).attr('checked',intranet_checked); - $("#hidden_editor_" + tab).attr('checked',editor_checked); - $("#hidden_collapsed_" + tab).attr('checked',collapsed_checked); - $("#hidden_flagged_" + tab).attr('checked',flagged_checked); + $("#hidden_opac_" + tab).prop('checked',opac_checked); + $("#hidden_intranet_" + tab).prop('checked',intranet_checked); + $("#hidden_editor_" + tab).prop('checked',editor_checked); + $("#hidden_collapsed_" + tab).prop('checked',collapsed_checked); + $("#hidden_flagged_" + tab).prop('checked',flagged_checked); enable_cb(tab); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js b/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js index 9c3f492..d8938b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js @@ -44,7 +44,7 @@ function build_target_record($sources) { 'code' : subfield }); } else { - $field_li.find('input.fieldpick').attr('checked', true); + $field_li.find('input.fieldpick').prop('checked', true); target_record[field] = [{ 'id' : $field_li.attr('id'), 'tag' : field, @@ -141,7 +141,7 @@ function rebuild_target($sources, $target) { $field_clone.find('ul').append($subfield_clone); } } else { - $('#' + field.id).find('input.fieldpick').removeAttr('checked'); + $('#' + field.id).find('input.fieldpick').prop('checked', false); } } } @@ -155,11 +155,11 @@ $(document).ready(function(){ $('input.fieldpick').click(function() { var ischecked = this.checked; if (ischecked) { - $(this).removeAttr('checked'); + $(this).prop('checked', false); if (!field_can_be_added($('#tabs'), $(this).parent())) { return false; } - $(this).attr('checked', 'checked'); + $(this).prop('checked', true); } // (un)check all subfields @@ -173,11 +173,11 @@ $(document).ready(function(){ $("input.subfieldpick").click(function() { var ischecked = this.checked; if (ischecked) { - $(this).removeAttr('checked'); + $(this).prop('checked', false); if (!subfield_can_be_added($('#tabs'), $(this).parent())) { return false; } - $(this).attr('checked', 'checked'); + $(this).prop('checked', true); } rebuild_target($('#tabs'), $('#resultul')); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js index 133194a..40ae5bd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js @@ -8,19 +8,19 @@ function hideColumns(){ valCookie = $.cookie("showColumns"); if(valCookie){ valCookie = valCookie.split("/"); - $("#showall").removeAttr("checked").parent().removeClass("selected"); + $("#showall").prop("checked", false).parent().removeClass("selected"); for( i=0; i<valCookie.length; i++ ){ if(valCookie[i] !== ''){ index = valCookie[i] - 2; $("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle(); - $("#checkheader"+index).removeAttr("checked").parent().removeClass("selected"); + $("#checkheader"+index).prop("checked", false).parent().removeClass("selected"); } } } } function hideColumn(num) { - $("#hideall,#showall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall,#showall").prop("checked", false).parent().removeClass("selected"); valCookie = $.cookie("showColumns"); // set the index of the table column to hide $("#"+num).parent().removeClass("selected"); @@ -56,7 +56,7 @@ Array.prototype.remove = function(from, to) { }; function showColumn(num){ - $("#hideall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall").prop("checked", false).parent().removeClass("selected"); $("#"+num).parent().addClass("selected"); valCookie = $.cookie("showColumns"); // set the index of the table column to hide @@ -84,13 +84,13 @@ function showAllColumns(){ $("#selections span").addClass("selected"); $("#itemst td:nth-child(2),#itemst tr th:nth-child(2)").nextAll().show(); $.removeCookie("showColumns", { path: '/' }); - $("#hideall").removeAttr("checked").parent().removeClass("selected"); + $("#hideall").prop("checked", false).parent().removeClass("selected"); } function hideAllColumns(){ $("#selections").unCheckCheckboxes(); $("#selections span").removeClass("selected"); $("#itemst td:nth-child(2),#itemst th:nth-child(2)").nextAll().hide(); - $("#hideall").attr("checked","checked").parent().addClass("selected"); + $("#hideall").prop("checked", true).parent().addClass("selected"); var cookieString = allColumns.join("/"); $.cookie("showColumns", cookieString, { expires : date, path: '/' }); } @@ -115,7 +115,7 @@ function hideAllColumns(){ }); $("#clearonloanbutton").click(function(){ $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function(){ - $(this).attr('checked', false); + $(this).prop('checked', false); }); return false; }); @@ -128,7 +128,7 @@ function hideAllColumns(){ hideAllColumns(); e.stopPropagation(); } else { - if($(this).attr("checked")){ + if($(this).prop("checked")){ showColumn(num); } else { hideColumn(num); diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js index cea3e88..092aa8d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js @@ -1,10 +1,10 @@ $(document).ready(function() { $("#CheckAllExports").on("click",function(){ - $(".export:visible").attr("checked", "checked" ); + $(".export:visible").prop("checked", true); return false; }); $("#UncheckAllExports").on("click",function(){ - $(".export:visible").removeAttr("checked"); + $(".export:visible").prop("checked", false); return false; }); @@ -48,7 +48,7 @@ $(document).ready(function() { }); function export_checkouts(format) { - if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){ + if ($("input:checkbox[name='biblionumbers']:checked").length < 1){ alert(MSG_EXPORT_SELECT_CHECKOUTS); return; } @@ -56,9 +56,9 @@ function export_checkouts(format) { $("input:checkbox[name='biblionumbers']").each( function(){ var input_item = $(this).siblings("input:checkbox"); if ( $(this).is(":checked") ) { - $(input_item).attr("checked", "checked"); + $(input_item).prop("checked", true); } else { - $(input_item).attr("checked", ""); + $(input_item).prop("checked", false); } } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 36bf23d..722b725 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -104,7 +104,7 @@ } } ); - $("input:checkbox").attr("checked", false); + $("input:checkbox").prop("checked", false); $("div.biblio.unselected select").attr("disabled", false); $("div.biblio.unselected input").attr("disabled", false); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 5aec704..ba5eaff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -26,7 +26,7 @@ updateColumnsVisibility($(this+":checked").val()); }); - $("#show_all_details").attr('checked', false); + $("#show_all_details").prop('checked', false); updateColumnsVisibility(false); [% UNLESS ( closedate ) %] $('#addtoBasket').on('show', function () { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index 59e20f9..26aa705 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -44,7 +44,7 @@ updateColumnsVisibility($(this+":checked").val()); }); - $("#show_all_details").attr('checked', false); + $("#show_all_details").prop('checked', false); updateColumnsVisibility(false); }); //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index e458af1..3c757ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -18,10 +18,10 @@ $(document).ready(function() { ] })); - $("#show_only_subscription").attr("checked", false); + $("#show_only_subscription").prop("checked", false); $("#show_only_subscription").click(function(){ - if ( $(this).attr("checked") ) { + if ( $(this).prop("checked") ) { resultst.fnFilter( "1", 0, true ); } else { resultst.fnFilter( '', 0 ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt index d6e65a0..1ca0a90 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt @@ -29,7 +29,7 @@ $("#show_only_renewed").click(function(){ updateRowsVisibility($(this+":checked").val()); }); - $("#show_only_renewed").attr('checked', false); + $("#show_only_renewed").prop('checked', false); updateRowsVisibility(false); $("#advsearch_form").show(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index 31b08c5..c229aa2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -88,10 +88,10 @@ function CheckNItems(n) { $("input[name='items_to_receive']").each(function() { - $(this).attr('checked', false); + $(this).prop('checked', false); }); $("input[name='items_to_receive']:lt("+n+")").each(function () { - $(this).attr('checked', true); + $(this).prop('checked', true); }); } [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index dba55df..5606337 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -125,8 +125,8 @@ function delete_contact(ev) { $('body').on('click', '.delete-contact', null, delete_contact); $('#add-contact').click(add_contact); $('body').on('click', '.contact_acqprimary', null, function () { - if ($(this).attr('checked') === 'checked') { - $('.contact_acqprimary').filter(':checked').not(this).removeAttr('checked'); + if ($(this).is(':checked')) { + $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false); $('.contact_acqprimary_hidden').each(function () { $(this).val('0'); }); @@ -134,19 +134,19 @@ function delete_contact(ev) { $(this).next('.contact_acqprimary_hidden').val('1'); }); $('body').on('click', '.contact_serialsprimary', null, function () { - if ($(this).attr('checked') === 'checked') { - $('.contact_serialsprimary').filter(':checked').not(this).removeAttr('checked'); + if ($(this).is(':checked')) { + $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false); $('.contact_serialsprimary_hidden').each(function () { $(this).val('0'); }); } - $(this).next('.contact_serialsprimary_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); + $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0'); }); $('body').on('click', '.contact_claimacquisition', null, function () { - $(this).next('.contact_claimacquisition_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); + $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0'); }); $('body').on('click', '.contact_claimissues', null, function () { - $(this).next('.contact_claimissues_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); + $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0'); }); }); //]]> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt index 988f88a..a1400b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -47,7 +47,7 @@ hideAllColumns(); e.stopPropagation(); } else { - if($(this).attr("checked")){ + if($(this).prop("checked")){ showColumn(num); } else { hideColumn(num); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt index e25f64a..8617c9d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -17,7 +17,7 @@ $("#active").removeAttr('disabled'); $("#hint").html(""); } else { - $("#active").removeAttr('checked'); + $("#active").prop('checked', false); $("#active").attr('disabled','disabled'); $("#hint").html(_("The active currency must have a rate of 1.0")); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index c7e27ad..4dc4eb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -17,7 +17,7 @@ function clear_edit(){ $(this).removeAttr("disabled"); } if ( type == "checkbox" ) { - $(this).attr('checked', false); + $(this).prop('checked', false); } }); $(edit_row).find("select").removeAttr("disabled"); @@ -58,7 +58,7 @@ $(document).ready(function() { } else if ( i == 12 ) { // specific processing for cap_fine_to_replacement_price var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']"); - $('#cap_fine_to_replacement_price').attr('checked', cap_fine_to_replacement_price.is(':checked') ); + $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') ); $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') ); } else { $(current_column).find("input[type='text']").val(itm); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index e314fa1..6ba9503 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -95,12 +95,12 @@ function verify_images() { [% IF StaffDetailItemSelection %] function selectAllItems(div) { - $("input[name='itemnumber'][type='checkbox']", div).attr('checked', 'checked'); + $("input[name='itemnumber'][type='checkbox']", div).prop('checked', true); itemSelectionBuildActionLinks(div); } function clearAllItems(div) { - $("input[name='itemnumber'][type='checkbox']", div).removeAttr('checked'); + $("input[name='itemnumber'][type='checkbox']", div).prop('checked', false); itemSelectionBuildActionLinks(div); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 0e77646..2910585 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -204,10 +204,10 @@ function highlightOn() { }[% END %] function selectAll () { - $(".selection").attr("checked", "checked"); + $(".selection").prop("checked", true); } function clearAll () { - $(".selection").removeAttr("checked"); + $(".selection").prop("checked", false); } function placeHold () { var checkedItems = $(".selection:checked"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt index deb74ab..94ecc86 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt @@ -111,8 +111,8 @@ $(document).ready(function(){ // Check all checkboxes in first tab, and uncheck all others to avoid // inconsistencies from a page refresh. - $('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').attr('checked', true); - $('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').removeAttr('checked'); + $('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').prop('checked', true); + $('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').prop('checked', false); //Set focus to cataloging search $("input[name=q]:eq(0)").focus(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index ec3a1d9..6c42d73 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -63,7 +63,7 @@ columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues // On-site checkout function toggle_onsite_checkout(){ - if ( $("#onsite_checkout").attr('checked') ) { + if ( $("#onsite_checkout").prop('checked') ) { $("#duedatespec").val("[% todaysdate | $KohaDates with_hours => 1%]") [% IF !Koha.Preference('SpecifyDueDate') %] $("#duedatespec").datetimepicker('destroy'); @@ -119,7 +119,7 @@ $(document).ready(function() { $('#table_borrowers tbody tr').removeClass('selected'); $(this).addClass('selected'); if (event.target.type !== 'radio') { - $(':radio', this).attr('checked', 'true') + $(':radio', this).prop('checked', 'true') } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 2c650d9..4dd0cae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -103,7 +103,7 @@ $(document).ready(function () { $("#barcode").focus(); }); [% IF(overduecharges) %] $("#barcode").focus(function () { - if (($("#exemptcheck").attr("checked") == true) || ($("#dropboxcheck").attr("checked") == true)) { + if (($("#exemptcheck").prop("checked") == true) || ($("#dropboxcheck").prop("checked") == true)) { $("#barcode").addClass("alert"); } else { $("#barcode").removeClass("alert"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt index f68027a..aa5031f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt @@ -18,7 +18,7 @@ $('input[name="flag"]').each(function() { if($(this).attr('id') != "flag-0"){ $(this).attr('disabled', 'disabled'); - $(this).removeAttr('checked', 'checked'); + $(this).prop('checked', false); } }); } @@ -28,7 +28,7 @@ $('input[name="flag"]').each(function() { if($(this).attr('id') != "flag-0"){ $(this).attr('disabled', 'disabled'); - $(this).removeAttr('checked', 'checked'); + $(this).prop('checked', false); } }); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 4f328d5..e43cdd2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1105,15 +1105,15 @@ function select_user(borrowernumber, borrower) { var transports = ['email', 'rss', 'sms']; $.each(transports, function(j, transport) { if (item['transports_' + transport] == 1) { - $('#' + transport + attrid).attr('checked', 'checked'); + $('#' + transport + attrid).prop('checked', true); } else { - $('#' + transport + attrid).removeAttr('checked'); + $('#' + transport + attrid).prop('checked', false); } }); if (item.digest && item.digest != ' ') { - $('#digest' + attrid).attr('checked', item.digest); + $('#digest' + attrid).prop('checked', true); } else { - $('#digest' + attrid).removeAttr('checked'); + $('#digest' + attrid).prop('checked', false); } if (item.takes_days == '1') { $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt index 4916d9e..75b217f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt @@ -24,16 +24,16 @@ }); var selectFieldNames = ["field_1","field_2","field_3"]; for (var i=0; i < selectFieldNames.length; i++) { - Go($("#"+selectFieldNames[i]+"_enable").attr("checked"), selectFieldNames[i]+"_select"); + Go($("#"+selectFieldNames[i]+"_enable").prop("checked"), selectFieldNames[i]+"_select"); } $("#field_1_enable").change(function(){ - $(".field_1_enable").html(Go($(this).attr("checked"), 'field_1_select')); + $(".field_1_enable").html(Go($(this).prop("checked"), 'field_1_select')); }); $("#field_2_enable").change(function(){ - $(".field_2_enable").html(Go($(this).attr("checked"), 'field_2_select')); + $(".field_2_enable").html(Go($(this).prop("checked"), 'field_2_select')); }); $("#field_3_enable").change(function(){ - $(".field_3_enable").html(Go($(this).attr("checked"), 'field_3_select')); + $(".field_3_enable").html(Go($(this).prop("checked"), 'field_3_select')); }); $("#barcode_print").load(barcode_text('barcode_param')); $("#barcode_print").change(function(){ @@ -41,11 +41,11 @@ }); function barcode_text(division) { var eBarcode = document.getElementById(division); - if( $("input[name=barcode_print]:checked").attr("checked") ) { + if( $("input[name=barcode_print]:checked").prop("checked") ) { eBarcode.style.display = 'block'; } else { eBarcode.style.display = 'none'; - $('input[name=barcode_text_print]').removeAttr('checked'); + $('input[name=barcode_text_print]').prop('checked', false); } } function getUnit(unit){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt index 546dea9..8fddf05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt @@ -13,7 +13,7 @@ $("#deldateTo").attr('disabled', false); } else { $("#removeddatetr").hide(); - $("input[value='deleteditems.timestamp']").attr('disabled', true).attr('checked', false); + $("input[value='deleteditems.timestamp']").attr('disabled', true).prop('checked', false); $("#deldateFrom").attr('disabled', true).val(''); $("#deldateTo").attr('disabled', true).val(''); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index dee52ed..9cec4f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -169,12 +169,12 @@ $(document).ready(function(){ [% IF (create || editsql || save) %] $("#select_group").change(function() { - if($(this).attr('checked')) { + if($(this).prop('checked')) { $("#group_input").attr('disabled', 'disabled'); $("#groupdesc_input").attr('disabled', 'disabled'); $("#group_select").attr('disabled', false); if ($("#group_select").val().length > 0) { - $("#select_subgroup").attr('checked', 'checked'); + $("#select_subgroup").prop('checked', true); $("#select_subgroup").change(); $("#subgroup, #subgroup *").show(); } else { @@ -183,11 +183,11 @@ $(document).ready(function(){ } }); $("#create_group").change(function() { - if($(this).attr('checked')) { + if($(this).prop('checked')) { $("#group_input").attr('disabled', false); $("#groupdesc_input").attr('disabled', false); $("#group_select").attr('disabled', 'disabled'); - $("#create_subgroup").attr('checked', 'checked').change(); + $("#create_subgroup").prop('checked', true).change(); $("#subgroup_select").hide(); $("#subgroup input[type='radio']").hide(); $("#subgroup label[for]").hide(); @@ -197,14 +197,14 @@ $(document).ready(function(){ } }); $("#select_subgroup").change(function() { - if($(this).attr('checked')) { + if($(this).prop('checked')) { $("#subgroup_select").attr('disabled', false); $("#subgroup_input").attr('disabled', 'disabled'); $("#subgroupdesc_input").attr('disabled', 'disabled'); } }); $("#create_subgroup").change(function() { - if($(this).attr('checked')) { + if($(this).prop('checked')) { $("#subgroup_input").attr('disabled', false); $("#subgroupdesc_input").attr('disabled', false); $("#subgroup_select").attr('disabled', 'disabled'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 473cfb4..2ae8d17 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -40,7 +40,7 @@ $(document).ready(function() { $('#table_borrowers tbody tr').removeClass('selected'); $(this).addClass('selected'); if (event.target.type !== 'radio') { - $(':radio', this).attr('checked', 'true') + $(':radio', this).prop('checked', 'true') } }); var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { @@ -152,7 +152,7 @@ function checkMultiHold() { $("#requestany").click(function() { if(this.checked){ $("input[name=checkitem]").each(function() { - $(this).removeAttr("checked"); + $(this).prop("checked", false); }); } }); @@ -164,9 +164,9 @@ function checkMultiHold() { } }); if(onechecked == 1){ - $("#requestany").removeAttr("checked"); + $("#requestany").prop("checked", false); } else { - $("#requestany").attr("checked","checked"); + $("#requestany").prop("checked",true); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt index dd77a73..4084dd3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt @@ -29,7 +29,7 @@ $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); $("#CheckAll").click(function() { - $("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked')); + $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked')); }); // Generates a dynamic link for exporting the selections data as CSV diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt index db8a9ec..4ea2295 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt @@ -10,13 +10,13 @@ <script type="text/javascript"> //<![CDATA[ function Check_boxes(dow) { - if($(":checkbox[data-dow='"+dow+"']:first").attr("checked") == 'checked') { + if($(":checkbox[data-dow='"+dow+"']:first").is(':checked')) { $("#predictionst :checkbox[data-dow='"+dow+"']").each(function(){ - $(this).attr('checked', true); + $(this).prop('checked', true); }); } else { $("#predictionst :checkbox[data-dow='"+dow+"']").each(function(){ - $(this).attr('checked', false); + $(this).prop('checked', false); }); } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt index 9df964b..d32839a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt @@ -36,7 +36,7 @@ $(document).ready(function() { $(".records input:checkbox[data-issues!='0']").each(function(){ $(this).attr('title', MSG_CANNOT_BE_DELETED) $(this).attr('disabled', true); - $(this).attr('checked', false); + $(this).prop('checked', false); $(this).parents('tr').find('td').css('background-color', '#ffff99'); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt index 2d8d5cf..4fcc5b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -27,13 +27,13 @@ })); $("#selectallbutton").click(function() { $("#borrowerst").find("input:checkbox").each(function() { - $(this).attr("checked", true); + $(this).prop("checked", true); }); return false; }); $("#clearallbutton").click(function() { $("#borrowerst").find("input:checkbox").each(function() { - $(this).attr("checked", false); + $(this).prop("checked", false); }); return false; }); -- 2.1.4