Bugzilla – Attachment 191707 Details for
Bug 41580
Tidy kohaTable block - tools
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41580: (follow-up) More tidy
Bug-41580-follow-up-More-tidy.patch (text/plain), 22.16 KB, created by
Owen Leonard
on 2026-01-20 15:26:14 UTC
(
hide
)
Description:
Bug 41580: (follow-up) More tidy
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-01-20 15:26:14 UTC
Size:
22.16 KB
patch
obsolete
>From 1c6d54c7c8d00badb52d324d172d0703f55203f4 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 20 Jan 2026 10:19:02 -0500 >Subject: [PATCH] Bug 41580: (follow-up) More tidy > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../en/modules/tools/manage-marc-import.tt | 204 ++++++++++-------- > .../prog/en/modules/tools/modborrowers.tt | 29 ++- > 2 files changed, 127 insertions(+), 106 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 1708a7e0ec7..b89d63e2e54 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 >@@ -467,27 +467,29 @@ > }); > </script> > <script> >- $(document).ready(function() { >- $("#staged-record-matching-rules select").change(function() { >+ $(document).ready(function () { >+ $("#staged-record-matching-rules select").change(function () { > var str = $(this).attr("id"); >- $("#reset_" + str).parent().show(); >+ $("#reset_" + str) >+ .parent() >+ .show(); > }); >- $("a.reset").click(function() { >+ $("a.reset").click(function () { > var str = $(this).attr("id"); >- str = str.replace("reset_", "") >+ str = str.replace("reset_", ""); > $("#" + str + " option[selected='selected']").attr("selected", "selected"); > $(this).parent().hide(); > }); > >- if (import_batch_id){ >+ if (import_batch_id) { > $("#records-table").kohaTable({ > autoWidth: false, > searching: false, > processing: true, >- serverSide: true, >+ serverSide: true, > ajax: { > url: "batch_records_ajax.pl", >- data: function ( d ) { >+ data: function (d) { > d.import_batch_id = import_batch_id; > return d; > }, >@@ -495,98 +497,119 @@ > bKohaAjaxSVC: true, > pagingType: "full_numbers", > dom: '<"top pager"iflp>rt<"bottom pager"flp><"clear">', >- columns: [ >- { data: "import_record_id" }, >- { data: "citation" }, >- { data: "status" }, >- { data: "overlay_status" }, >- { data: null, defaultContent: "" }, >- { data: null, defaultContent: "" }, >- { data: "matched" } >- ], >- rowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { >- var record_details_url = record_type == 'auth' ? "/cgi-bin/koha/authorities/detail.pl?authid=":"/cgi-bin/koha/catalogue/detail.pl?biblionumber="; >- var record_edit_url = record_type == 'auth' ? "/cgi-bin/koha/authorities/authorities.pl?authid=":"/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; >+ columns: [{ data: "import_record_id" }, { data: "citation" }, { data: "status" }, { data: "overlay_status" }, { data: null, defaultContent: "" }, { data: null, defaultContent: "" }, { data: "matched" }], >+ rowCallback: function (nRow, aData, iDisplayIndex, iDisplayIndexFull) { >+ var record_details_url = record_type == "auth" ? "/cgi-bin/koha/authorities/detail.pl?authid=" : "/cgi-bin/koha/catalogue/detail.pl?biblionumber="; >+ var record_edit_url = record_type == "auth" ? "/cgi-bin/koha/authorities/authorities.pl?authid=" : "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; > > var additional_details = ""; >- if( aData['author'] ){ >- additional_details += " " + escape_str(aData['author']) + " "; >+ if (aData["author"]) { >+ additional_details += " " + escape_str(aData["author"]) + " "; > } > >- if( aData['isbn'] ){ >- additional_details += " (" + escape_str(aData['isbn']) + ") "; >+ if (aData["isbn"]) { >+ additional_details += " (" + escape_str(aData["isbn"]) + ") "; > } > >- if( aData['issn'] ){ >- additional_details += " (" + escape_str(aData['issn']) + ") "; >+ if (aData["issn"]) { >+ additional_details += " (" + escape_str(aData["issn"]) + ") "; > } > >- $('td:eq(1)', nRow).html( >- '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + escape_str(aData['citation']) + '</a> ' + additional_details >- ); >+ $("td:eq(1)", nRow).html('<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData["import_record_id"] + '&viewas=html" class="previewMARC">' + escape_str(aData["citation"]) + "</a> " + additional_details); > >- $('td:eq(2)', nRow).html( >- aData['status'] == 'imported' ? _("Imported") : >- aData['status'] == 'ignored' ? _("Ignored") : >- aData['status'] == 'reverted' ? _("Reverted") : >- aData['status'] == 'staged' ? _("Staged") : >- aData['status'] == 'error' ? _("Error") : >- aData['status'] >+ $("td:eq(2)", nRow).html( >+ aData["status"] == "imported" >+ ? _("Imported") >+ : aData["status"] == "ignored" >+ ? _("Ignored") >+ : aData["status"] == "reverted" >+ ? _("Reverted") >+ : aData["status"] == "staged" >+ ? _("Staged") >+ : aData["status"] == "error" >+ ? _("Error") >+ : aData["status"] > ); > >- $('td:eq(3)', nRow).html( >- aData['overlay_status'] == 'no_match' ? _("No match") : >- aData['overlay_status'] == 'match_applied' ? _("Match applied") : >- aData['overlay_status'] == 'auto_match' ? _("Match found") : >- aData['overlay_status'] >+ $("td:eq(3)", nRow).html( >+ aData["overlay_status"] == "no_match" ? _("No match") : aData["overlay_status"] == "match_applied" ? _("Match applied") : aData["overlay_status"] == "auto_match" ? _("Match found") : aData["overlay_status"] > ); > >- if ( aData['matches'].length > 0 ) { >- >+ if (aData["matches"].length > 0) { > var any_checked = 0; >- $('td:eq(4)', nRow).html('<ul class="matches"></ul>'); >- $('td:eq(5)', nRow).html('<ul class="matches"></ul>'); >+ $("td:eq(4)", nRow).html('<ul class="matches"></ul>'); >+ $("td:eq(5)", nRow).html('<ul class="matches"></ul>'); > var checked = ""; > var disabled = ""; >- if( aData['status'] == "imported" || aData['status'] == "ignored" ){ >- disabled = ' disabled '; >+ if (aData["status"] == "imported" || aData["status"] == "ignored") { >+ disabled = " disabled "; > } >- aData['matches'].forEach(function(item,index){ >- if( item.chosen == 1 ){ >+ aData["matches"].forEach(function (item, index) { >+ if (item.chosen == 1) { > checked = 'checked="checked"'; > any_checked = 1; > } >- var match_option = ""; >- match_option = '<input type="radio" data-import_record_id="'+aData['import_record_id']+'" class="chosen" name="import_record_id_'+aData['import_record_id']+'_match" value="'+item.candidate_match_id+'" ' + checked + disabled + '> '; >+ var match_option = ""; >+ match_option = >+ '<input type="radio" data-import_record_id="' + >+ aData["import_record_id"] + >+ '" class="chosen" name="import_record_id_' + >+ aData["import_record_id"] + >+ '_match" value="' + >+ item.candidate_match_id + >+ '" ' + >+ checked + >+ disabled + >+ "> "; > >- var diff_url = '/cgi-bin/koha/tools/showdiffmarc.pl?batchid=%s&importid=%s&id=%s&type=%s'; >- var match_citation = ''; >- var matching_msg = ''; >- if ( item.record_type == 'auth' ){ >- matching_msg = _("Matches authority %s (score=%s):%s"); >- if( item.authorized_heading ){ match_citation += item.authorized_heading } >- } else { >- matching_msg = _("Matches bibliographic record %s (score=%s):%s"); >- if( item.title ){ match_citation += item.title + ' ' } >- if( item.author ){ match_citation += item.author } >+ var diff_url = "/cgi-bin/koha/tools/showdiffmarc.pl?batchid=%s&importid=%s&id=%s&type=%s"; >+ var match_citation = ""; >+ var matching_msg = ""; >+ if (item.record_type == "auth") { >+ matching_msg = _("Matches authority %s (score=%s):%s"); >+ if (item.authorized_heading) { >+ match_citation += item.authorized_heading; >+ } >+ } else { >+ matching_msg = _("Matches bibliographic record %s (score=%s):%s"); >+ if (item.title) { >+ match_citation += item.title + " "; > } >- $('td:eq(4) ul', nRow).append('<li><label for="import_record_id_'+aData['import_record_id']+'_match_'+index+'">'+match_option+ >- matching_msg.format(item.candidate_match_id, item.score, >- '<a target="_blank" href="' + record_details_url >- + item.candidate_match_id + '">' + match_citation + '</a></label></li>') >+ if (item.author) { >+ match_citation += item.author; >+ } >+ } >+ $("td:eq(4) ul", nRow).append( >+ '<li><label for="import_record_id_' + >+ aData["import_record_id"] + >+ "_match_" + >+ index + >+ '">' + >+ match_option + >+ matching_msg.format(item.candidate_match_id, item.score, '<a target="_blank" href="' + record_details_url + item.candidate_match_id + '">' + match_citation + "</a></label></li>") > ); >- $('td:eq(5) ul', nRow).append('<li><a href="' >- + diff_url.format(import_batch_id, aData['import_record_id'], item.candidate_match_id, item.record_type) + '">' + _("View") + '</a></li>'); >+ $("td:eq(5) ul", nRow).append('<li><a href="' + diff_url.format(import_batch_id, aData["import_record_id"], item.candidate_match_id, item.record_type) + '">' + _("View") + "</a></li>"); > checked = ""; > }); >- if( !any_checked ){ checked = 'checked="checked"'; } >- $('td:eq(4) ul', nRow).prepend('<li><label><input type="radio" data-import_record_id="'+aData['import_record_id']+'" class="chosen" name="import_record_id_'+aData['import_record_id']+'_match" value="none" ' + checked + disabled + ' > '+_("Ignore matches")+'</label></li>'); >- $('td:eq(5) ul', nRow).prepend('<li> </li>'); >- } >- if (aData['diff_url']) { >- $('td:eq(5)', nRow).html( >- '<a href="' + aData['diff_url'] + '">' + _("View") + '</a>' >+ if (!any_checked) { >+ checked = 'checked="checked"'; >+ } >+ $("td:eq(4) ul", nRow).prepend( >+ '<li><label><input type="radio" data-import_record_id="' + >+ aData["import_record_id"] + >+ '" class="chosen" name="import_record_id_' + >+ aData["import_record_id"] + >+ '_match" value="none" ' + >+ checked + >+ disabled + >+ " > " + >+ _("Ignore matches") + >+ "</label></li>" > ); >+ $("td:eq(5) ul", nRow).prepend("<li> </li>"); >+ } >+ if (aData["diff_url"]) { >+ $("td:eq(5)", nRow).html('<a href="' + aData["diff_url"] + '">' + _("View") + "</a>"); > } > if (aData["matched"]) { > let buttons = '<a class="btn btn-default btn-xs" target="_blank" href="' + record_details_url + aData["matched"] + '"><i class="fa-solid fa-eye"></i> ' + _("View") + "</a> "; >@@ -597,44 +620,47 @@ > } > }, > }); >- $("#revert_batch_form").on("submit", function() { >+ $("#revert_batch_form").on("submit", function () { > return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")); > }); > } > >- $("body").on("change", ".chosen", function(e) { >+ $("body").on("change", ".chosen", function (e) { > let apimethod = "DELETE"; >- let apidata =""; >- if( $(this).val() != 'none' ){ >- apimethod = 'PUT'; >+ let apidata = ""; >+ if ($(this).val() != "none") { >+ apimethod = "PUT"; > apidata = JSON.stringify({ candidate_match_id: $(this).val() }); > } > $.ajax({ >- url: '/api/v1/import_batches/' + import_batch_id + '/records/'+$(this).data('import_record_id')+'/matches/chosen', >+ url: "/api/v1/import_batches/" + import_batch_id + "/records/" + $(this).data("import_record_id") + "/matches/chosen", > method: apimethod, > data: apidata, >- contentType: 'application/json' >- }).fail(function(){ alert(_("Unable to update match choices")); return false; }); >+ contentType: "application/json", >+ }).fail(function () { >+ alert(_("Unable to update match choices")); >+ return false; >+ }); > }); > >- $("body").on("click", ".previewMARC", function(e) { >+ $("body").on("click", ".previewMARC", function (e) { > e.preventDefault(); > var ltitle = $(this).text(); > var page = $(this).attr("href"); > $("#marcPreviewLabel").text(ltitle); > $("#marcPreview .modal-body").load(page + " table"); >- $('#marcPreview').modal("show"); >+ $("#marcPreview").modal("show"); > }); >- $("#marcPreview").on("hidden.bs.modal", function() { >+ $("#marcPreview").on("hidden.bs.modal", function () { > $("#marcPreviewLabel").html(""); >- $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>"); >+ $("#marcPreview .modal-body").html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>"); > }); >- $(".batch_form").on("submit", function() { >+ $(".batch_form").on("submit", function () { > if ($(this).hasClass("batch_delete")) { > return confirm(_("Are you sure you want to permanently delete this batch?")); > } else { >- if ($(this).find("input[name='import_status']").val() === "imported" ) { >- return confirm(_("This batch contains imported records. Are you sure you wish to clear all the reservoir records? This cannot be undone.")); >+ if ($(this).find("input[name='import_status']").val() === "imported") { >+ return confirm(_("This batch contains imported records. Are you sure you wish to clear all the reservoir records? This cannot be undone.")); > } else { > return confirm(_("Clear all reservoir records staged in this batch? This cannot be undone.")); > } >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 de8d9c78ce2..89102f2b4d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -568,45 +568,40 @@ > return false; > }); > >- $('select[name="patron_attributes"]').change(function() { >+ $('select[name="patron_attributes"]').change(function () { > updateAttrValues(this); >- } ); >+ }); > > $('select[name="patron_attributes"]').change(); > >- $(".clear-date").on("click",function(e){ >+ $(".clear-date").on("click", function (e) { > e.preventDefault(); >- var fieldID = this.id.replace("clear-date-",""); >+ var fieldID = this.id.replace("clear-date-", ""); > $("#" + fieldID).val(""); > }); >- $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){ >+ $("#cataloguing_additem_newitem").on("click", ".add_attributes", function (e) { > e.preventDefault(); > add_attributes(); > }); >- $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){ >+ $("#cataloguing_additem_newitem").on("click", ".del_attributes", function (e) { > e.preventDefault(); > del_attributes(this); > }); > >- $('form[name="f"]').on("submit", function(){ >+ $('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(){ >+ 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( >- $('<input>') >- .attr('type', 'hidden') >- .attr('name', 'borrowernumber') >- .val(borrowernumber) >- ); >+ if (!$(form).find('input[name="borrowernumber"][value="' + borrowernumber + '"]').length) { >+ $(form).append($("<input>").attr("type", "hidden").attr("name", "borrowernumber").val(borrowernumber)); > } > }); > }); > } > >- $("#patron_batchmod_form").on("submit", function(){ >+ $("#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") { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41580
:
191163
|
191164
|
191165
|
191166
|
191167
|
191168
|
191169
|
191170
|
191171
|
191697
|
191698
|
191699
|
191700
|
191701
|
191702
|
191703
|
191704
|
191705
|
191706
| 191707