From c44428ce53e19a726f9fe709eff67678fe9190da Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 20 Jan 2026 09:27:08 -0500 Subject: [PATCH] Bug 41580: (follow-up) Fixes for errors - In Cataloging -> Manage staged MARC records: the logic around showing the "Edit" button was not correct - In Tools -> Batch patron modification: There was sometimes an error in the console about a variable not existing which can be resolved by moving the corresponding (and related) JS into the conditional which depends on the table of results existing. Signed-off-by: Owen Leonard --- .../en/modules/tools/manage-marc-import.tt | 15 ++-- .../prog/en/modules/tools/modborrowers.tt | 68 ++++++++++--------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt index 472d5d80ac7..1708a7e0ec7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt @@ -588,15 +588,12 @@ '' + _("View") + '' ); } - if (aData['matched']) { - $('td:eq(6)', nRow).html( - ' ' + _("View") + ' ' - if (perms.CAN_user_editcatalogue_edit_catalogue){ - + ' ' + _("Edit") + '' - } - ); + if (aData["matched"]) { + let buttons = ' ' + _("View") + " "; + if (permissions.CAN_user_editcatalogue_edit_catalogue) { + buttons += ' ' + _("Edit") + ""; + } + $("td:eq(6)", nRow).html(buttons); } }, }); 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 5cca9f84fed..de8d9c78ce2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -567,28 +567,46 @@ }); return false; }); - } - $('select[name="patron_attributes"]').change(function () { - updateAttrValues(this); - }); + $('select[name="patron_attributes"]').change(function() { + updateAttrValues(this); + } ); - $('select[name="patron_attributes"]').change(); + $('select[name="patron_attributes"]').change(); - $(".clear-date").on("click", function (e) { - e.preventDefault(); - var fieldID = this.id.replace("clear-date-", ""); - $("#" + fieldID).val(""); - }); - $("#cataloguing_additem_newitem").on("click", ".add_attributes", function (e) { - e.preventDefault(); - add_attributes(); - }); - $("#cataloguing_additem_newitem").on("click", ".del_attributes", function (e) { - e.preventDefault(); - del_attributes(this); - }); - $("#patron_batchmod_form").on("submit", function () { + $(".clear-date").on("click",function(e){ + e.preventDefault(); + var fieldID = this.id.replace("clear-date-",""); + $("#" + fieldID).val(""); + }); + $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){ + e.preventDefault(); + add_attributes(); + }); + $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){ + e.preventDefault(); + del_attributes(this); + }); + + $('form[name="f"]').on("submit", function(){ + // Add the checkboxes to the DOM before we submit the form + var form = this; + var checkboxes = $(patron_table).find('input:checkbox:checked').serializeArray(); + $.each(checkboxes, function(){ + let borrowernumber = this.value; + if(!$(form).find('input[name="borrowernumber"][value="'+borrowernumber+'"]').length){ + $(form).append( + $('') + .attr('type', 'hidden') + .attr('name', 'borrowernumber') + .val(borrowernumber) + ); + } + }); + }); + } + + $("#patron_batchmod_form").on("submit", function(){ /* Reset form fields on inactive tabs */ var tab = $(this).find("ul.nav-tabs li a.active").attr("href"); if (tab == "#usecardnumber_panel") { @@ -600,18 +618,6 @@ $("#borrowernumberuploadfile, #cardnumberuploadfile, #borrowernumberlist, #cardnumberlist").val(""); } }); - - $('form[name="f"]').on("submit", function () { - // Add the checkboxes to the DOM before we submit the form - var form = this; - var checkboxes = $(patron_table).find("input:checkbox:checked").serializeArray(); - $.each(checkboxes, function () { - let borrowernumber = this.value; - if (!$(form).find('input[name="borrowernumber"][value="' + borrowernumber + '"]').length) { - $(form).append($("").attr("type", "hidden").attr("name", "borrowernumber").val(borrowernumber)); - } - }); - }); }); function updateAttrValues(select_attr) { -- 2.39.5