Bugzilla – Attachment 191171 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: tools - auto tidy
52c6b50.patch (text/plain), 85.63 KB, created by
Jonathan Druart
on 2026-01-09 14:53:46 UTC
(
hide
)
Description:
Bug 41580: tools - auto tidy
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-01-09 14:53:46 UTC
Size:
85.63 KB
patch
obsolete
>From 52c6b50282021ff95d4abc89099f07a4d1278dd9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Jan 2026 13:16:55 +0100 >Subject: [PATCH] Bug 41580: tools - auto tidy > >--- > .../en/modules/tools/batch_delete_records.tt | 160 +++--- > .../en/modules/tools/batch_modify_holds.tt | 467 +++++++++--------- > .../tools/batch_record_modification.tt | 61 ++- > .../prog/en/modules/tools/holidays.tt | 1 - > .../prog/en/modules/tools/inventory.tt | 168 +++---- > .../en/modules/tools/manage-marc-import.tt | 10 +- > .../prog/en/modules/tools/modborrowers.tt | 125 ++--- > .../prog/en/modules/tools/upload.tt | 171 +++---- > 8 files changed, 571 insertions(+), 592 deletions(-) > >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 c2e6a6aafa4..324f0970676 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 >@@ -266,138 +266,132 @@ > <script> > const record_type = "[% recordtype | html %]"; > </script> >- > <script> > var MSG_CANNOT_BE_DELETED = _("This record cannot be deleted, at least one item is currently checked out."); >- $(document).ready(function() { >- >- $("input[type='radio']").click(function() { >- if ($(this).attr('id') == 'authority_type') { >+ $(document).ready(function () { >+ $("input[type='radio']").click(function () { >+ if ($(this).attr("id") == "authority_type") { > $("a[href='#shelves_tab_panel']").parent().hide(); > $("li.skip_open_orders").hide(); >- } else if ($(this).attr('id') == 'biblio_type') { >+ } else if ($(this).attr("id") == "biblio_type") { > $("a[href='#shelves_tab_panel']").parent().show(); > $("li.skip_open_orders").show(); > } > }); > >- $("#selectall").click(function(e){ >+ $("#selectall").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { > $(this).prop("checked", true); > }); > }); > >- $("#clearall").click(function(e){ >+ $("#clearall").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { > $(this).prop("checked", false); > }); > }); > >- $("#selectwithoutitems").click(function(e){ >+ $("#selectwithoutitems").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >- if( $(this).data("items") == 0 ){ >- $(this).prop("checked", true ); >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { >+ if ($(this).data("items") == 0) { >+ $(this).prop("checked", true); > } else { >- $(this).prop("checked", false ); >+ $(this).prop("checked", false); > } > }); > }); > >- $("#selectnotreserved").click(function(e){ >+ $("#selectnotreserved").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >- if( $(this).data("reserves") == 0 ){ >- $(this).prop("checked", true ); >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { >+ if ($(this).data("reserves") == 0) { >+ $(this).prop("checked", true); > } else { >- $(this).prop("checked", false ); >+ $(this).prop("checked", false); > } > }); > }); > >- $("#selectwithoutsubscriptions").click(function(e){ >+ $("#selectwithoutsubscriptions").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >- if( $(this).data("subscriptions") == 0 ){ >- $(this).prop("checked", true ); >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { >+ if ($(this).data("subscriptions") == 0) { >+ $(this).prop("checked", true); > } else { >- $(this).prop("checked", false ); >+ $(this).prop("checked", false); > } > }); > }); > >- $("#clearlinkedtobiblio").click(function(e){ >+ $("#clearlinkedtobiblio").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']:not(:disabled)").each(function(){ >- if( $(this).data("usage") == 0 ){ >- $(this).prop("checked", true ); >+ $(".records input[type='checkbox']:not(:disabled)").each(function () { >+ if ($(this).data("usage") == 0) { >+ $(this).prop("checked", true); > } else { >- $(this).prop("checked", false ); >+ $(this).prop("checked", false); > } > }); > }); > >- $("#selectall").click(); >+ $("#selectall").click(); > >- // Show a red cross if a biblio cannot be deleted >- if (recordtype == 'biblio'){ >- $(".records input:checkbox[data-issues!='0']").each(function(){ >- $(this).parents('tr').find('td').css('background-color', '#ffff99') >- $(this).replaceWith("<span class='error'><i class='fa fa-times fa-lg'></i></span>") >- $(".records i").attr('title', MSG_CANNOT_BE_DELETED) >- }); >- } >- >- $("#biblios").kohaTable({ >- columnDefs: [ >- { targets: [3, 4], type: "num-html" }, >- ], >- dom: "t", >- order: [], >- paging: false, >- }); >+ // Show a red cross if a biblio cannot be deleted >+ if (recordtype == "biblio") { >+ $(".records input:checkbox[data-issues!='0']").each(function () { >+ $(this).parents("tr").find("td").css("background-color", "#ffff99"); >+ $(this).replaceWith("<span class='error'><i class='fa fa-times fa-lg'></i></span>"); >+ $(".records i").attr("title", MSG_CANNOT_BE_DELETED); >+ }); >+ } > >- $("#authorities").kohaTable({ >- columnDefs: [ >- { targets: [3], type: "num-html" }, >- ], >- dom: "t", >- order: [], >- paging: false, >- }); >+ $("#biblios").kohaTable({ >+ columnDefs: [{ targets: [3, 4], type: "num-html" }], >+ dom: "t", >+ order: [], >+ paging: false, >+ }); > >- $("#selectrecords").on("submit",function(){ >- var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size(); >- if (nb_checked == 0){ >- alert(_("No records have been selected.")); >- return false; >- } >- }); >+ $("#authorities").kohaTable({ >+ columnDefs: [{ targets: [3], type: "num-html" }], >+ dom: "t", >+ order: [], >+ paging: false, >+ }); > >- $("#selectauths").on("submit",function(){ >- var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size(); >- if (checked == 0) { >- alert(_("No authorities have been selected.")); >- return false; >- } >- }); >+ $("#selectrecords").on("submit", function () { >+ var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size(); >+ if (nb_checked == 0) { >+ alert(_("No records have been selected.")); >+ return false; >+ } >+ }); > >- $("#record_ids_selection").on("submit", function(e){ >- var tab = $(this).find('#batch_del_form li a.active:first').attr('href'); >- if ( tab == '#uploadfile_tab_panel' ) { >- $("#shelf_number").empty(''); >- $("#recordnumber_list").val(''); >- } else if ( tab == '#shelves_tab_panel' ) { >- $("#uploadfile").val('') >- $("#recordnumber_list").val(''); >- } else { // enterlist >- $("#uploadfile").val('') >- $("#shelf_number").empty(''); >- } >- }); >+ $("#selectauths").on("submit", function () { >+ var checked = $("#selectauths").find("input[type='checkbox'][name='record_id']:checked").size(); >+ if (checked == 0) { >+ alert(_("No authorities have been selected.")); >+ return false; >+ } >+ }); > >+ $("#record_ids_selection").on("submit", function (e) { >+ var tab = $(this).find("#batch_del_form li a.active:first").attr("href"); >+ if (tab == "#uploadfile_tab_panel") { >+ $("#shelf_number").empty(""); >+ $("#recordnumber_list").val(""); >+ } else if (tab == "#shelves_tab_panel") { >+ $("#uploadfile").val(""); >+ $("#recordnumber_list").val(""); >+ } else { >+ // enterlist >+ $("#uploadfile").val(""); >+ $("#shelf_number").empty(""); >+ } >+ }); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >index de509e0dab6..df2eba4502a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_modify_holds.tt >@@ -252,60 +252,57 @@ > var holds_to_modify_table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_hold_modification', 'holds_to_modify', 'json' ) | $raw %]; > var modified_holds_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'modified_holds', 'json' ) | $raw %]; > </script> >- > <script> >- $(document).ready(function() { >- >+ $(document).ready(function () { > // Apply select2 to all select fields having a "multiple" attribute >- let selectFields = document.querySelectorAll('select[multiple]'); >- selectFields.forEach((selectField) => { >- selectField.style.minWidth = '200px'; >+ let selectFields = document.querySelectorAll("select[multiple]"); >+ selectFields.forEach(selectField => { >+ selectField.style.minWidth = "200px"; > $(selectField).select2(); > }); > > //Empty local storage from previous selections > localStorage.removeItem("holds_modify_selections"); > >- $("#holds_to_modify").on("change", "input[type='checkbox']", function(){ >+ $("#holds_to_modify").on("change", "input[type='checkbox']", function () { > var holds_modify_selections = JSON.parse(localStorage.getItem("holds_modify_selections")) || []; > var hold_id = $(this).val(); > if ($(this).prop("checked")) { >- > hold_data = { > hold_id: hold_id, >- found_status: $(this).closest('tr').find('.found_status').children('span').data('found-status'), >- suspended: $(this).closest('tr').find('.suspended').children('span').data('suspended'), >- } >+ found_status: $(this).closest("tr").find(".found_status").children("span").data("found-status"), >+ suspended: $(this).closest("tr").find(".suspended").children("span").data("suspended"), >+ }; > > holds_modify_selections.push(hold_data); > localStorage.setItem("holds_modify_selections", JSON.stringify(holds_modify_selections)); > showHoldSelections(holds_modify_selections.length); > } else { >- var filtered = holds_modify_selections.filter(function( hold_obj ){ >+ var filtered = holds_modify_selections.filter(function (hold_obj) { > return hold_obj.hold_id !== hold_id; > }); >- if( filtered.length > 0 ){ >- localStorage.setItem("holds_modify_selections", JSON.stringify( filtered )); >+ if (filtered.length > 0) { >+ localStorage.setItem("holds_modify_selections", JSON.stringify(filtered)); > holds_modify_selections = filtered; >- showHoldSelections( filtered.length ); >+ showHoldSelections(filtered.length); > } else { > holds_modify_selections = []; > localStorage.removeItem("holds_modify_selections"); >- showHoldSelections( 0 ); >+ showHoldSelections(0); > } > } > }); > >- $("#select_all").on("click", function(e){ >+ $("#select_all").on("click", function (e) { > e.preventDefault(); >- $("#holds_to_modify input[type='checkbox']").each(function(){ >+ $("#holds_to_modify input[type='checkbox']").each(function () { > $(this).prop("checked", true).change(); > }); > }); > >- $("#clear_all").on("click", function(e){ >+ $("#clear_all").on("click", function (e) { > e.preventDefault(); >- $("#holds_to_modify input[type='checkbox']").each(function(){ >+ $("#holds_to_modify input[type='checkbox']").each(function () { > $(this).prop("checked", false).change(); > }); > }); >@@ -317,80 +314,76 @@ > $("#table_search_selections").hide(); > }); > >- $('#modify_holds_form').submit(function() { >+ $("#modify_holds_form").submit(function () { > var modify_holds_form = $(this); > search_holds(modify_holds_form); > $("#modify_holds_search").hide(); >- $('#edit_search').show(); >+ $("#edit_search").show(); > return false; > }); > >- if(hold_ids_from_sql.length > 0){ >- $('#modify_holds_form').trigger('submit'); >+ if (hold_ids_from_sql.length > 0) { >+ $("#modify_holds_form").trigger("submit"); > } > >- $("#edit_search").on("click", function(e){ >+ $("#edit_search").on("click", function (e) { > e.preventDefault(); >- $('#modify_holds_search').show(); >- $('#edit_search').hide(); >+ $("#modify_holds_search").show(); >+ $("#edit_search").hide(); > }); > >- function showHoldSelections( number ){ >+ function showHoldSelections(number) { > if (number === 0) { > $("#table_search_selections").hide(); > } else { >- $("#table_search_selections") >- .show() >- .find("span") >- .text(_("Holds selected: %s").format(number)); >+ $("#table_search_selections").show().find("span").text(_("Holds selected: %s").format(number)); > } > } > >- function search_holds(modify_holds_form){ >+ function search_holds(modify_holds_form) { > var searchpattern = ""; > var filters = { >- "me.expirationdate": function(){ >+ "me.expirationdate": function () { > var expirationdate_from = modify_holds_form.find("#expirationdate_from").val(); >- var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); >+ var expirationdate_to = modify_holds_form.find("#expirationdate_to").val(); > >- if (expirationdate_from && expirationdate_to){ >+ if (expirationdate_from && expirationdate_to) { > searchpattern += _("expiration date between ") + expirationdate_from + " and " + expirationdate_to + " "; >- return {"-between": [expirationdate_from, expirationdate_to]}; >- } >- else if (expirationdate_from && !expirationdate_to){ >+ return { "-between": [expirationdate_from, expirationdate_to] }; >+ } else if (expirationdate_from && !expirationdate_to) { > searchpattern += _("expiration date from ") + expirationdate_from + " "; >- return {">=": expirationdate_from }; >- } else if (!expirationdate_from && expirationdate_to){ >+ return { ">=": expirationdate_from }; >+ } else if (!expirationdate_from && expirationdate_to) { > searchpattern += _("expiration date to ") + expirationdate_to + " "; >- return {"<=": expirationdate_to }; >+ return { "<=": expirationdate_to }; > } > }, >- "me.branchcode": function(){ >+ "me.branchcode": function () { > var branchcodes = modify_holds_form.find("#branchcodes").val(); >- if( branchcodes.length > 0 ){ >+ if (branchcodes.length > 0) { > searchpattern += _("from libraries "); > var selected_libraries = modify_holds_form.find("#branchcodes option:selected"); >- $.each(selected_libraries, function(key, value) { >+ $.each(selected_libraries, function (key, value) { > searchpattern += value.text + " "; > }); >- return {"-in": branchcodes }; >+ return { "-in": branchcodes }; > } > }, >- "me.status": function(){ >+ "me.status": function () { > var found_status = modify_holds_form.find("#found_status").val(); >- if( found_status.length > 0 ){ >- var filters = [{"-in": found_status}]; >- if(jQuery.inArray("NULL", found_status) !== -1){ >- filters.push({"=": null}); >+ if (found_status.length > 0) { >+ var filters = [{ "-in": found_status }]; >+ if (jQuery.inArray("NULL", found_status) !== -1) { >+ filters.push({ "=": null }); > } > searchpattern += _("found status in "); >- $.each(found_status, function(key, value) { >+ $.each(found_status, function (key, value) { > let status = _("No status "); >- if ( value == "T" ) { >+ if (value == "T") { > status = _("In transit "); >- } else if( value == "P" ) { >+ } else if (value == "P") { > status = _("In processing "); >- } else if( value == "W" ) { >+ } else if (value == "W") { > status = _("Waiting "); > } > searchpattern += status; >@@ -398,259 +391,257 @@ > return filters; > } > }, >- "me.suspended": function(){ >+ "me.suspended": function () { > var suspend_status = modify_holds_form.find("#suspend_status").val(); > >- if(suspend_status != "none"){ >+ if (suspend_status != "none") { > var suspended_text = suspend_status == 0 ? _("Not suspended") : _("Suspended"); > searchpattern += _("with suspend status ") + suspended_text; > >- return {"=": suspend_status}; >+ return { "=": suspend_status }; > } > }, >- "me.suspend_until": function(){ >+ "me.suspend_until": function () { > var suspend_until_from = modify_holds_form.find("#suspend_until_from").val(); >- var suspend_until_to = modify_holds_form.find("#suspend_until_to").val(); >+ var suspend_until_to = modify_holds_form.find("#suspend_until_to").val(); > >- if (suspend_until_from && suspend_until_to){ >+ if (suspend_until_from && suspend_until_to) { > searchpattern += _("suspend date between ") + suspend_until_from + " and " + suspend_until_to + " "; >- return {"-between": [suspend_until_from, suspend_until_to]}; >- } >- else if (suspend_until_from && !suspend_until_to){ >+ return { "-between": [suspend_until_from, suspend_until_to] }; >+ } else if (suspend_until_from && !suspend_until_to) { > searchpattern += _("suspend date from ") + suspend_until_from + " "; >- return {">=": suspend_until_from }; >- } else if (!suspend_until_from && suspend_until_to){ >+ return { ">=": suspend_until_from }; >+ } else if (!suspend_until_from && suspend_until_to) { > searchpattern += _("suspend date to ") + suspend_until_to + " "; >- return {"<=": suspend_until_to }; >+ return { "<=": suspend_until_to }; > } > }, >- "me.notes": function(){ >+ "me.notes": function () { > var holdnotes = modify_holds_form.find("#holdnotes").val(); > > searchpattern += holdnotes ? _("hold notes like ") + holdnotes : ""; > >- return holdnotes ? {"-like": "%"+holdnotes+"%"} : ""; >+ return holdnotes ? { "-like": "%" + holdnotes + "%" } : ""; > }, >- "me.hold_id": function(){ >+ "me.hold_id": function () { > return hold_ids_from_sql.length > 0 ? { "-in": hold_ids_from_sql } : ""; >- } >- } >- >- var holds_modify_table = $("#holds_to_modify").kohaTable({ >- ajax: { >- "url": "/api/v1/holds" > }, >- embed: [ >- "biblio", >- "item", >- "pickup_library", >- "patron" >- ], >- destroy: true, >- autoWidth: false, >- processing: true, >- order: [ >- [1, 'asc'] >- ], >- columns: [ >- { >- "data": "hold_id", >- "name": "checkbox", >- "orderable": false, >- "render": function(data, type, row, meta) { >- return '<input class="selection" type="checkbox" value="'+ encodeURIComponent(data) +'"/>' >- } >- }, >- { >- "data": "hold_date", >- "name": "hold_date", >- "type": "date", >- "title": _("Hold date"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return $date(data); >- } >- }, >- { >- "data": "expiration_date", >- "name": "expiration_date", >- "type": "date", >- "title": _("Expiration date"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return $date(data); >- } >- }, >- { >- "data": "biblio.title:biblio.subtitle:biblio.medium", >- "title": _("Title"), >- "searchable": true, >- "orderable": true, >- "render": function(data, type, row, meta) { >- return $biblio_to_html(row.biblio, { link: 1 }); >- } >- }, >- { >- "data": "item.external_id", >- "name": "barcode", >- "title": _("Barcode"), >- "defaultContent": _(""), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- if( row.item ){ >- let item_id = encodeURIComponent( row.item_id ); >- let biblio_id = encodeURIComponent( row.biblio_id ); >- return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' + >- 'itemnumber='+ item_id +'&biblionumber='+ biblio_id +'&' + >- 'bi='+ biblio_id +'#item'+ item_id +'">' + escape_str( data ) + '</a>' >- } >- } >- }, >- { >- "data": "patron_id", >- "name": "patron", >- "title": _("Patron"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name }); >- return patron_to_html; >- } >- }, >- { >- "data": "status", >- "name": "status", >- "title": _("Status"), >- "className": "found_status", >- "orderable": true, >- "render": function( data, type, row, meta ) { >- let status = _("No status"); >- if ( data == "T" ) { >- status = _("In transit"); >- } else if( data == "P" ) { >- status = _("In processing"); >- } else if( data == "W" ) { >- status = _("Waiting"); >- } >- return "<span data-found-status='" + escape_str( data ) + "'>" + status + "</span>"; >- } >- }, >- { >- "data": "pickup_library_id", >- "name": "pickup_library", >- "title": _("Hold pickup library"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str( row.pickup_library.name ); >- } >- }, >- { >- "data": "suspended", >- "name": "suspended", >- "className": "suspended", >- "title": _("Suspended"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- var suspended_string = data == 0 ? _("No") : _("Yes"); >- return "<span data-suspended='" + data + "'>" + suspended_string + "</span>"; >- } >- }, >- { >- "data": "suspended_until", >- "name": "suspended_until", >- "title": _("Suspended until"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return $date( data ); >- } >+ }; >+ >+ var holds_modify_table = $("#holds_to_modify").kohaTable( >+ { >+ ajax: { >+ url: "/api/v1/holds", > }, >- { >- "data": "notes", >- "name": "notes", >- "title": _("Notes"), >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str( data ); >- } >- } >- ], >- }, holds_to_modify_table_settings, 0, filters); >+ embed: ["biblio", "item", "pickup_library", "patron"], >+ destroy: true, >+ autoWidth: false, >+ processing: true, >+ order: [[1, "asc"]], >+ columns: [ >+ { >+ data: "hold_id", >+ name: "checkbox", >+ orderable: false, >+ render: function (data, type, row, meta) { >+ return '<input class="selection" type="checkbox" value="' + encodeURIComponent(data) + '"/>'; >+ }, >+ }, >+ { >+ data: "hold_date", >+ name: "hold_date", >+ type: "date", >+ title: _("Hold date"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $date(data); >+ }, >+ }, >+ { >+ data: "expiration_date", >+ name: "expiration_date", >+ type: "date", >+ title: _("Expiration date"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $date(data); >+ }, >+ }, >+ { >+ data: "biblio.title:biblio.subtitle:biblio.medium", >+ title: _("Title"), >+ searchable: true, >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $biblio_to_html(row.biblio, { link: 1 }); >+ }, >+ }, >+ { >+ data: "item.external_id", >+ name: "barcode", >+ title: _("Barcode"), >+ defaultContent: _(""), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ if (row.item) { >+ let item_id = encodeURIComponent(row.item_id); >+ let biblio_id = encodeURIComponent(row.biblio_id); >+ return '<a href="/cgi-bin/koha/catalogue/moredetail.pl?' + "itemnumber=" + item_id + "&biblionumber=" + biblio_id + "&" + "bi=" + biblio_id + "#item" + item_id + '">' + escape_str(data) + "</a>"; >+ } >+ }, >+ }, >+ { >+ data: "patron_id", >+ name: "patron", >+ title: _("Patron"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ let patron_to_html = $patron_to_html(row.patron, { url: true, display_cardnumber: true, hide_patron_name }); >+ return patron_to_html; >+ }, >+ }, >+ { >+ data: "status", >+ name: "status", >+ title: _("Status"), >+ className: "found_status", >+ orderable: true, >+ render: function (data, type, row, meta) { >+ let status = _("No status"); >+ if (data == "T") { >+ status = _("In transit"); >+ } else if (data == "P") { >+ status = _("In processing"); >+ } else if (data == "W") { >+ status = _("Waiting"); >+ } >+ return "<span data-found-status='" + escape_str(data) + "'>" + status + "</span>"; >+ }, >+ }, >+ { >+ data: "pickup_library_id", >+ name: "pickup_library", >+ title: _("Hold pickup library"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return escape_str(row.pickup_library.name); >+ }, >+ }, >+ { >+ data: "suspended", >+ name: "suspended", >+ className: "suspended", >+ title: _("Suspended"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ var suspended_string = data == 0 ? _("No") : _("Yes"); >+ return "<span data-suspended='" + data + "'>" + suspended_string + "</span>"; >+ }, >+ }, >+ { >+ data: "suspended_until", >+ name: "suspended_until", >+ title: _("Suspended until"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return $date(data); >+ }, >+ }, >+ { >+ data: "notes", >+ name: "notes", >+ title: _("Notes"), >+ orderable: true, >+ render: function (data, type, row, meta) { >+ return escape_str(data); >+ }, >+ }, >+ ], >+ }, >+ holds_to_modify_table_settings, >+ 0, >+ filters >+ ); > > $(".searchpattern").text(searchpattern); > > $("#modify_holds_results-wrapper").show(); > } > >- $("#process_mods").on('submit', function(e) { >- >- var hold_ids = JSON.parse( localStorage.getItem("holds_modify_selections") ) || []; >+ $("#process_mods").on("submit", function (e) { >+ var hold_ids = JSON.parse(localStorage.getItem("holds_modify_selections")) || []; > > $("#process_mods input[name='hold_id']").remove(); > >- hold_ids.forEach(function(hold) { >- $('<input>').attr({ >- type: 'hidden', >- name: 'hold_id', >- value: hold.hold_id >- }).appendTo('#process_mods'); >+ hold_ids.forEach(function (hold) { >+ $("<input>") >+ .attr({ >+ type: "hidden", >+ name: "hold_id", >+ value: hold.hold_id, >+ }) >+ .appendTo("#process_mods"); > }); > > var errors = []; > > var new_expiration_date = $("#new_expiration_date").val(); >- var new_pickup_loc = $("#new_pickup_loc").val(); >- var new_suspend_status = $("#new_suspend_status").val(); >- var new_suspend_date = $("#new_suspend_date").val(); >- var new_hold_note = $("#new_hold_note").val(); >- var clear_hold_notes = $("#clear_hold_notes").val(); >+ var new_pickup_loc = $("#new_pickup_loc").val(); >+ var new_suspend_status = $("#new_suspend_status").val(); >+ var new_suspend_date = $("#new_suspend_date").val(); >+ var new_hold_note = $("#new_hold_note").val(); >+ var clear_hold_notes = $("#clear_hold_notes").val(); > >- if ( hold_ids.length == 0 ) { >+ if (hold_ids.length == 0) { > e.preventDefault(); > errors.push(_("Please select at least one hold to process.")); > } > >- if( new_pickup_loc || new_suspend_status || new_suspend_date ){ >+ if (new_pickup_loc || new_suspend_status || new_suspend_date) { > var found = false; >- hold_ids.forEach(function(hold){ >- if( hold.found_status ){ >+ hold_ids.forEach(function (hold) { >+ if (hold.found_status) { > e.preventDefault(); > found = true; > } > }); >- if( ( new_suspend_status || new_suspend_date ) && found ){ >+ if ((new_suspend_status || new_suspend_date) && found) { > errors.push(_("One or more holds have found status and can't be suspended.")); > } >- if( new_pickup_loc && found ){ >+ if (new_pickup_loc && found) { > errors.push(_("One or more holds have found status and their pick up location can't be changed.")); > } > } > > var suspended = false; > >- hold_ids.forEach(function(hold){ >- if( hold.suspened ){ >+ hold_ids.forEach(function (hold) { >+ if (hold.suspened) { > suspended = true; > } > }); > >- if( ( !new_suspend_status || new_suspend_status == "0" || !suspended ) && new_suspend_date ){ >+ if ((!new_suspend_status || new_suspend_status == "0" || !suspended) && new_suspend_date) { > new_suspend_status = 1; > } > > if (errors.length > 0) { > e.preventDefault(); > $("#errorList").html(errors.map(error => `<li>${error}</li>`).join("")); >- $("#errorModal").modal('show'); >+ $("#errorModal").modal("show"); > return false; > } > return true; > }); > > //Modified holds table >- $("#modified_holds").kohaTable({ >- pagingType: "full", >- autoWidth: false >- }, modified_holds_table_settings); >- >+ $("#modified_holds").kohaTable( >+ { >+ pagingType: "full", >+ autoWidth: false, >+ }, >+ modified_holds_table_settings >+ ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt >index fb57026222b..56f6a614f9b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt >@@ -323,35 +323,33 @@ > const interface = "[% interface | html %]"; > const theme = "[% theme | html %]"; > </script> >- > <script> >- function update_tab_display(){ >+ function update_tab_display() { > let selected_type = $('input[name="recordtype"]:checked').val(); >- if (selected_type == 'authority') { >+ if (selected_type == "authority") { > $("a[href='#shelves_tab_panel']").parent().hide(); > $("a[href='#uploadfile_tab_panel']").tab("show"); >- } else if (selected_type == 'biblio') { >+ } else if (selected_type == "biblio") { > $("a[href='#shelves_tab_panel']").parent().show(); > $("a[href='#uploadfile_tab_panel']").tab("show"); > } > } >- $(document).ready(function() { >- >+ $(document).ready(function () { > update_tab_display(); >- $("input[type='radio']").click(function() { >+ $("input[type='radio']").click(function () { > update_tab_display(); > }); > >- $("#selectall").click(function(e){ >+ $("#selectall").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']").each(function(){ >+ $(".records input[type='checkbox']").each(function () { > $(this).prop("checked", true); > }); > }); > >- $("#clearall").click(function(e){ >+ $("#clearall").click(function (e) { > e.preventDefault(); >- $(".records input[type='checkbox']").each(function(){ >+ $(".records input[type='checkbox']").each(function () { > $(this).prop("checked", false); > }); > }); >@@ -359,24 +357,20 @@ > $("#selectall").click(); > > $("#biblios").kohaTable({ >- columnDefs: [ >- { targets: [1], type: "num-html" }, >- ], >+ columnDefs: [{ targets: [1], type: "num-html" }], > dom: "t", > order: [], > paging: false, > }); > > $("#authorities").kohaTable({ >- columnDefs: [ >- { targets: [1], type: "num-html" }, >- ], >+ columnDefs: [{ targets: [1], type: "num-html" }], > dom: "t", > order: [], > paging: false, > }); > >- $("#mainformsubmit").click(function() { >+ $("#mainformsubmit").click(function () { > if ($("input[type=checkbox][name='record_id']:checked").length == 0) { > alert(_("Please select at least one record to process")); > return false; >@@ -388,36 +382,37 @@ > return true; > }); > >- $("#record_ids_selection").on("submit", function(e) { >- var tab = $(this).find('#batch_mod_form li a.active:first').attr('href'); >- if (tab == '#uploadfile_tab_panel') { >- $("#recordnumber_list, #shelf_number").val(''); >- } else if (tab == '#shelves_tab_panel') { >- $("#recordnumber_list, #uploadfile").val(''); >- } else { // enterlist >- $("#uploadfile, #shelf_number").val('') >+ $("#record_ids_selection").on("submit", function (e) { >+ var tab = $(this).find("#batch_mod_form li a.active:first").attr("href"); >+ if (tab == "#uploadfile_tab_panel") { >+ $("#recordnumber_list, #shelf_number").val(""); >+ } else if (tab == "#shelves_tab_panel") { >+ $("#recordnumber_list, #uploadfile").val(""); >+ } else { >+ // enterlist >+ $("#uploadfile, #shelf_number").val(""); > } > }); > >- $("#marc_modification_template_id").change(function() { >- var url = "/cgi-bin/koha/svc/records/preview?" >+ $("#marc_modification_template_id").change(function () { >+ var url = "/cgi-bin/koha/svc/records/preview?"; > var mmtid = $(this).val(); >- $("a.previewMARC").each(function() { >+ $("a.previewMARC").each(function () { > $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod"); > }); > }); > >- $("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 + " div"); >- $('#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>"); > }); > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index f56bf11fac9..f3ab2245d3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -452,7 +452,6 @@ > const calendardate = "[% calendardate | html %]"; > const keydate = "[% keydate | html %]"; > </script> >- > <script> > function holidayOperation(formObject, opType) { > var op = document.getElementsByName('operation'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >index 44a0cd87b22..05ebea1cae2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -413,22 +413,18 @@ > </script> > <script> > function checkForm() { >- if ( $('#uploadbarcodes').val() && $('#barcodelist').val() ) { >+ if ($("#uploadbarcodes").val() && $("#barcodelist").val()) { > alert(_("You have uploaded a barcode file and scanned barcodes at the same time. Please choose one of the two options.")); > return false; > } >- if ( $('#uploadbarcodes').val() || $('#barcodelist').val() ) { >- if ( !( >- $('#branchloop').val() || >- $('#locationloop').val() || >- $('#minlocation').val() || >- $('#maxlocation').val() || >- $('#statuses input:checked').length >- ) ) { >+ if ($("#uploadbarcodes").val() || $("#barcodelist").val()) { >+ if (!($("#branchloop").val() || $("#locationloop").val() || $("#minlocation").val() || $("#maxlocation").val() || $("#statuses input:checked").length)) { > return confirm( >- _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + "\n\n" + >- _("For large catalogs this can result in unexpected behavior") + "\n\n" + >- _("Are you sure you want to do this?") >+ _("You have not selected any catalog filters and are about to compare a file of barcodes to your entire catalog.") + >+ "\n\n" + >+ _("For large catalogs this can result in unexpected behavior") + >+ "\n\n" + >+ _("Are you sure you want to do this?") > ); > } > } >@@ -437,105 +433,105 @@ > } > > function barcodesProvided() { >- if( $("#uploadbarcodes").val() || $("#barcodelist").val() ) { >- $("#setdate").prop('disabled',false); >- $("#compareinv2barcd").prop('disabled',false); >- $("#compareinv2barcd").attr('checked',true); // default >- $("#dont_checkin").prop('disabled',false); >- $("#out_of_order").prop('disabled',false); >- if( $("#compareinv2barcd").attr('checked') ) { >+ if ($("#uploadbarcodes").val() || $("#barcodelist").val()) { >+ $("#setdate").prop("disabled", false); >+ $("#compareinv2barcd").prop("disabled", false); >+ $("#compareinv2barcd").attr("checked", true); // default >+ $("#dont_checkin").prop("disabled", false); >+ $("#out_of_order").prop("disabled", false); >+ if ($("#compareinv2barcd").attr("checked")) { > $("fieldset#optionalfilters").show(); >- $("#ignoreissued").attr('checked',true); // default >+ $("#ignoreissued").attr("checked", true); // default > } else { > $("fieldset#optionalfilters").hide(); >- $("#ignoreissued").attr('checked',false); >+ $("#ignoreissued").attr("checked", false); > } > } else { >- $("#setdate").prop('disabled',true); >- $("#compareinv2barcd").prop('disabled',true); >- $("#compareinv2barcd").attr('checked',false); >- $("#dont_checkin").prop('disabled',true); >- $("#dont_checkin").attr('checked',false); >- $("#out_of_order").prop('disabled',true); >- $("#out_of_order").attr('checked',false); >+ $("#setdate").prop("disabled", true); >+ $("#compareinv2barcd").prop("disabled", true); >+ $("#compareinv2barcd").attr("checked", false); >+ $("#dont_checkin").prop("disabled", true); >+ $("#dont_checkin").attr("checked", false); >+ $("#out_of_order").prop("disabled", true); >+ $("#out_of_order").attr("checked", false); > $("fieldset#optionalfilters").show(); > } > } > >- $(document).ready(function(){ >- inventorydt = $("#inventoryt").kohaTable({ >- pagingType: 'full_numbers', >- bKohaColumnsUseNames: true, >- ...(uploadedbarcodesflag >- ? { >- // sort on callnumber >- order: [[ 2, "asc" ]] >- } >- : { >- // first column contains checkboxes >- columnDefs: [ >- { orderable: false, searchable: false, targets: [ 0 ] } >- ], >- // 3rd column is callnumber >- order: [[ 2, "asc" ]], >- }), >- drawCallback: function() { >- //bind the click handler script to the newly created elements held in the table >- $('.openWin').bind('click',function(e){ >- e.preventDefault(); >- openWindow(this.href,'marcview',800,600); >- }); >- } >- }, table_settings ); >- >- >- $("#continuewithoutmarkingbutton").click(function(){ >- inventorydt.DataTable().page('next').draw('page'); >+ $(document).ready(function () { >+ inventorydt = $("#inventoryt").kohaTable( >+ { >+ pagingType: "full_numbers", >+ bKohaColumnsUseNames: true, >+ ...(uploadedbarcodesflag >+ ? { >+ // sort on callnumber >+ order: [[2, "asc"]], >+ } >+ : { >+ // first column contains checkboxes >+ columnDefs: [{ orderable: false, searchable: false, targets: [0] }], >+ // 3rd column is callnumber >+ order: [[2, "asc"]], >+ }), >+ drawCallback: function () { >+ //bind the click handler script to the newly created elements held in the table >+ $(".openWin").bind("click", function (e) { >+ e.preventDefault(); >+ openWindow(this.href, "marcview", 800, 600); >+ }); >+ }, >+ }, >+ table_settings >+ ); >+ >+ $("#continuewithoutmarkingbutton").click(function () { >+ inventorydt.DataTable().page("next").draw("page"); > return false; > }); > >- $("#markseenandcontinuebutton").click(function(){ >- var param = ''; >- $("input:checked").each(function() { >- param += "|" + $(this).attr('name'); >+ $("#markseenandcontinuebutton").click(function () { >+ var param = ""; >+ $("input:checked").each(function () { >+ param += "|" + $(this).attr("name"); > }); >- $.post('/cgi-bin/koha/tools/ajax-inventory.pl', { seen: param, op: 'cud-seen', csrf_token: $('meta[name="csrf-token"]').attr("content") }); >- inventorydt.DataTable().page('next').draw('page'); >+ $.post("/cgi-bin/koha/tools/ajax-inventory.pl", { seen: param, op: "cud-seen", csrf_token: $('meta[name="csrf-token"]').attr("content") }); >+ inventorydt.DataTable().page("next").draw("page"); > return false; > }); > >- $("#markseenandquit").click(function(){ >- var param = ''; >- $("input:checked").each(function() { >- param += "|" + $(this).attr('name'); >+ $("#markseenandquit").click(function () { >+ var param = ""; >+ $("input:checked").each(function () { >+ param += "|" + $(this).attr("name"); > }); > $.ajax({ >- type: 'POST', >- url: '/cgi-bin/koha/tools/ajax-inventory.pl', >- data: { seen: param, op: 'cud-seen', csrf_token: $('meta[name="csrf-token"]').attr("content") }, >- async: false >+ type: "POST", >+ url: "/cgi-bin/koha/tools/ajax-inventory.pl", >+ data: { seen: param, op: "cud-seen", csrf_token: $('meta[name="csrf-token"]').attr("content") }, >+ async: false, > }); >- document.location.href = '/cgi-bin/koha/tools/inventory.pl'; >+ document.location.href = "/cgi-bin/koha/tools/inventory.pl"; > return false; > }); > >- $(".checkall").click(function(e){ >+ $(".checkall").click(function (e) { > e.preventDefault(); >- $("#inventoryt input:checkbox").each(function(){ >+ $("#inventoryt input:checkbox").each(function () { > $(this).prop("checked", true); > }); > }); >- $(".clearall").click(function(e){ >+ $(".clearall").click(function (e) { > e.preventDefault(); >- $("#inventoryt input:checkbox").each(function(){ >+ $("#inventoryt input:checkbox").each(function () { > $(this).prop("checked", false); > }); > }); >- $("#inventory_form").on("submit",function(){ >+ $("#inventory_form").on("submit", function () { > return checkForm(); > }); > >- $("#resetuploadbarcodes").click(function() { >+ $("#resetuploadbarcodes").click(function () { > $("#uploadbarcodes").val(""); > barcodesProvided(); > }); >@@ -545,23 +541,23 @@ > $("#uploadbarcodes").change(barcodesProvided); > $("#barcodelist").on("change keyup paste", barcodesProvided); > >- $("#compareinv2barcd").click(function() { >- if( $("#compareinv2barcd").attr('checked') ) { >+ $("#compareinv2barcd").click(function () { >+ if ($("#compareinv2barcd").attr("checked")) { > $("fieldset#optionalfilters").show(); >- $("#ignoreissued").attr('checked',true); // default >+ $("#ignoreissued").attr("checked", true); // default > } else { >- $("#ignoreissued").attr('checked',false); >+ $("#ignoreissued").attr("checked", false); > $("fieldset#optionalfilters").hide(); > } > }); > >- $("#checkallitemtypes").on("click",function(e){ >+ $("#checkallitemtypes").on("click", function (e) { > e.preventDefault(); >- $(".branch_select").prop("checked",1); >+ $(".branch_select").prop("checked", 1); > }); >- $("#checknoneitemtypes").on("click",function(e){ >+ $("#checknoneitemtypes").on("click", function (e) { > e.preventDefault(); >- $(".branch_select").prop("checked",0); >+ $(".branch_select").prop("checked", 0); > }); > }); > </script> >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 15b711e7c55..472d5d80ac7 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 >@@ -466,7 +466,6 @@ > CAN_user_editcatalogue_edit_catalogue: [% CAN_user_editcatalogue_edit_catalogue ? 1 : 0 | html %], > }); > </script> >- > <script> > $(document).ready(function() { > $("#staged-record-matching-rules select").change(function() { >@@ -646,13 +645,14 @@ > }); > }); > </script> >- > [% IF job_enqueued %] > <script> >- $(document).ready(function() { >+ $(document).ready(function () { > setTimeout( >- function() { window.location.href=$('a.job_details').attr('href'); }, >- 5000, // 5 secs to read >+ function () { >+ window.location.href = $("a.job_details").attr("href"); >+ }, >+ 5000 // 5 secs to read > ); > }); > </script> >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 b4bc3fa94ba..5cca9f84fed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -513,30 +513,29 @@ > patron_attributes_values["[% pav.attribute_code | html %]"] = lib; > [% END %] > </script> >- > <script> >- $(document).ready(function() { >- if (has_patrons){ >- let selections_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_selections'); >+ $(document).ready(function () { >+ if (has_patrons) { >+ let selections_column = table_settings.columns.find(c => c.columnname == "batch_patron_edit_selections"); > selections_column.cannot_be_modified = 1; > selections_column.cannot_be_toggled = 1; > selections_column.force_visibility = 1; >- if (op == 'show'){ >+ if (op == "show") { > selections_column.is_hidden = 0; > } else { > selections_column.is_hidden = 1; > } > >- if (!permissions.CanUpdatePasswordExpiration){ >- let password_expiration_date_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_password_expiration_date'); >+ if (!permissions.CanUpdatePasswordExpiration) { >+ let password_expiration_date_column = table_settings.columns.find(c => c.columnname == "batch_patron_edit_password_expiration_date"); > password_expiration_date_column.is_hidden = 1; > password_expiration_date_column.cannot_be_modified = 1; > password_expiration_date_column.cannot_be_toggled = 1; > password_expiration_date_column.force_visibility = 1; > } > >- if (!permissions.CanUpdateProtectPatron){ >- let protected_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_protected'); >+ if (!permissions.CanUpdateProtectPatron) { >+ let protected_column = table_settings.columns.find(c => c.columnname == "batch_patron_edit_protected"); > protected_column.is_hidden = 1; > protected_column.cannot_be_modified = 1; > protected_column.cannot_be_toggled = 1; >@@ -552,91 +551,91 @@ > table_settings > ); > >- $("#selectallbutton").click(function() { >- $("#borrowerst").find("input:checkbox").each(function() { >- $(this).prop("checked", true); >- }); >+ $("#selectallbutton").click(function () { >+ $("#borrowerst") >+ .find("input:checkbox") >+ .each(function () { >+ $(this).prop("checked", true); >+ }); > return false; > }); >- $("#clearallbutton").click(function() { >- $("#borrowerst").find("input:checkbox").each(function() { >- $(this).prop("checked", false); >- }); >+ $("#clearallbutton").click(function () { >+ $("#borrowerst") >+ .find("input:checkbox") >+ .each(function () { >+ $(this).prop("checked", false); >+ }); > 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); > }); >- $("#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' ) { >+ var tab = $(this).find("ul.nav-tabs li a.active").attr("href"); >+ if (tab == "#usecardnumber_panel") { > $("#borrowernumberuploadfile, #patron_list_id, #borrowernumberlist").val(""); >- } else if ( tab == '#useborrowernumber_panel' ) { >+ } else if (tab == "#useborrowernumber_panel") { > $("#cardnumberuploadfile, #cardnumberlist, #patron_list_id").val(""); >- } else { // uselist_panel >+ } else { >+ // uselist_panel > $("#borrowernumberuploadfile, #cardnumberuploadfile, #borrowernumberlist, #cardnumberlist").val(""); > } > }); > >- $('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)); > } > }); > }); > }); > >- function updateAttrValues (select_attr) { >+ function updateAttrValues(select_attr) { > var attr_code = $(select_attr).val(); > var selected_option = $(select_attr).find("option:selected"); >- var type = $(selected_option).attr('data-type'); >- var category = $(selected_option).attr('data-category'); >+ var type = $(selected_option).attr("data-type"); >+ var category = $(selected_option).attr("data-category"); > var li_node = $(select_attr).parent(); >- var span = $(li_node).find('span.patron_attributes_value'); >- var information_category_node = $(li_node).find('span.information_category'); >+ var span = $(li_node).find("span.patron_attributes_value"); >+ var information_category_node = $(li_node).find("span.information_category"); > information_category_node.html(""); > >- if ( category && category.length > 0 ) { >+ if (category && category.length > 0) { > information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category)); > } > var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']"); >- if ( type == 'select' ) { >+ if (type == "select") { > var options = '<option value = ""></option>'; >- for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) { >- options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>'; >+ for (var i = 0; i < patron_attributes_values[attr_code].length; i++) { >+ options += '<option value="' + patron_attributes_values[attr_code][i] + '">' + patron_attributes_lib[attr_code][i] + "</option>"; > } >- span.html('<select name="patron_attributes_value">' + options + '</select>'); >+ span.html('<select name="patron_attributes_value">' + options + "</select>"); > $(disable_input_node).show(); >- } else if ( $(selected_option).val() != "" ) { >+ } else if ($(selected_option).val() != "") { > span.html('<input type="text" name="patron_attributes_value"/>'); > $(disable_input_node).show(); > } else { >@@ -649,16 +648,18 @@ > var count = $("li.attributes").length; > var li_node = $("li.attributes:last"); > var li_clone = $(li_node).clone(); >- if ( $(li_clone).find("a.del_attributes").length == 0 ) { >- var add_attributes = $(li_clone).find("a.add_attributes") >- $(add_attributes).after('<a href="#" title="' + _("Delete") + '" class="del_attributes"><i class="fa fa-fw fa-trash-can"></i> ' + _("Delete") + '</a>'); >+ if ($(li_clone).find("a.del_attributes").length == 0) { >+ var add_attributes = $(li_clone).find("a.add_attributes"); >+ $(add_attributes).after('<a href="#" title="' + _("Delete") + '" class="del_attributes"><i class="fa fa-fw fa-trash-can"></i> ' + _("Delete") + "</a>"); > } >- li_node.find("label").attr("for", li_node.find("label").attr("for") + "_" + count ); >- li_node.find("input, select").attr("id", li_node.find("select").attr("id") + "_" + count ); >+ li_node.find("label").attr("for", li_node.find("label").attr("for") + "_" + count); >+ li_node.find("input, select").attr("id", li_node.find("select").attr("id") + "_" + count); > >- $(li_clone).find('select[name="patron_attributes"]').change(function() { >- updateAttrValues(this); >- } ); >+ $(li_clone) >+ .find('select[name="patron_attributes"]') >+ .change(function () { >+ updateAttrValues(this); >+ }); > > $(li_clone).find('select[name="patron_attributes"]').change(); > >@@ -667,17 +668,19 @@ > } > > function del_attributes(a_node) { >- $(a_node).parent('li').remove(); >+ $(a_node).parent("li").remove(); > update_attr_values(); > } > > function update_attr_values() { >- $("li.attributes").each(function(i) { >- $(this).find("input:checkbox").val("attr"+i+"_value"); >+ $("li.attributes").each(function (i) { >+ $(this) >+ .find("input:checkbox") >+ .val("attr" + i + "_value"); > }); > } > function clearDate(nodeid) { >- $("#"+nodeid).val(""); >+ $("#" + nodeid).val(""); > } > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >index 16ceb2f1767..2f12b0d95e4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -375,92 +375,87 @@ > }); > const msg_alert = "[% msg | html %]"; > </script> >- > <script> > function StartUpload() { >- if( $('#fileToUpload').prop('files').length == 0 ) return; >- $('#fileToUpload').prop('disabled',true); >- $('#fileuploadbutton').hide(); >+ if ($("#fileToUpload").prop("files").length == 0) return; >+ $("#fileToUpload").prop("disabled", true); >+ $("#fileuploadbutton").hide(); > $("#fileuploadcancel").show(); >- $("#fileuploadfailed").html(''); >- $("#myalerts").hide(''); >- $("#myalerts").html(''); >+ $("#fileuploadfailed").html(""); >+ $("#myalerts").hide(""); >+ $("#myalerts").html(""); > $("#fileuploadstatus").show(); >- $("#uploadedfileid").val(''); >+ $("#uploadedfileid").val(""); > $("#searchfile").hide(); >- $("#lastbreadcrumb").text( _("Add a new upload") ); >+ $("#lastbreadcrumb").text(_("Add a new upload")); > >- var cat, xtra=''; >- if( $("#uploadcategory").val() ) >- cat = encodeURIComponent( $("#uploadcategory").val() ); >- if( cat ) xtra= 'category=' + cat + '&'; >- if (plugin){ >- xtra = xtra + 'public=1&temp=0'; >+ var cat, >+ xtra = ""; >+ if ($("#uploadcategory").val()) cat = encodeURIComponent($("#uploadcategory").val()); >+ if (cat) xtra = "category=" + cat + "&"; >+ if (plugin) { >+ xtra = xtra + "public=1&temp=0"; > } else { >- if( !cat ) xtra = 'temp=1&'; >- if( $('#public').prop('checked') ) xtra = xtra + 'public=1'; >+ if (!cat) xtra = "temp=1&"; >+ if ($("#public").prop("checked")) xtra = xtra + "public=1"; > } >- xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), xtra, cbUpload ); >+ xhr = AjaxUpload($("#fileToUpload"), $("#fileuploadprogress"), xtra, cbUpload); > } > function CancelUpload() { >- if( xhr ) xhr.abort(); >+ if (xhr) xhr.abort(); > $("#fileuploadstatus").hide(); >- $('#fileToUpload').prop('disabled', false); >- $('#fileuploadbutton').show(); >+ $("#fileToUpload").prop("disabled", false); >+ $("#fileuploadbutton").show(); > $("#fileuploadcancel").hide(); > $("#fileuploadfailed").show(); >- $("#fileuploadfailed").text( _("Upload status: Cancelled ") ); >+ $("#fileuploadfailed").text(_("Upload status: Cancelled ")); > } >- function cbUpload( status, fileid, err ) { >- $('#fileToUpload').prop('disabled', false); >- if( status=='done' ) { >- var e = err? JSON.stringify(err): ''; >- SubmitMe( 'search', fileid, e ); >+ function cbUpload(status, fileid, err) { >+ $("#fileToUpload").prop("disabled", false); >+ if (status == "done") { >+ var e = err ? JSON.stringify(err) : ""; >+ SubmitMe("search", fileid, e); > } else { >- $('#fileuploadbutton').show(); >+ $("#fileuploadbutton").show(); > $("#fileuploadcancel").hide(); > $("#fileuploadstatus").hide(); > $("#fileuploadfailed").show(); >- $("#fileuploadfailed").html( _("Upload status: ") + >- ( status=='failed'? _("Failed"): >- ( status=='denied'? _("Denied"): status )) >- ); >- ShowAlerts( err ); >+ $("#fileuploadfailed").html(_("Upload status: ") + (status == "failed" ? _("Failed") : status == "denied" ? _("Denied") : status)); >+ ShowAlerts(err); > } > } > function ShowAlerts(err) { >- var str = ''; >- for( var file in err ) { >- str= str + '<p>' + file + ': ' + >- errMESSAGES( err[file].code ) + '</p>'; >+ var str = ""; >+ for (var file in err) { >+ str = str + "<p>" + file + ": " + errMESSAGES(err[file].code) + "</p>"; > } >- if( str ) { >- $('#myalerts').html(str); >- $('#myalerts').show(); >+ if (str) { >+ $("#myalerts").html(str); >+ $("#myalerts").show(); > } > } > function errMESSAGES(code) { > var rv; >- switch(code) { >- case 'UPLERR_ALREADY_EXISTS': >+ switch (code) { >+ case "UPLERR_ALREADY_EXISTS": > rv = _("This file already exists (in this category)."); > break; >- case 'UPLERR_CANNOT_WRITE': >+ case "UPLERR_CANNOT_WRITE": > rv = _("File could not be created. Check permissions."); > break; >- case 'UPLERR_NO_ROOT_DIR': >+ case "UPLERR_NO_ROOT_DIR": > rv = _("Your koha-conf.xml does not contain a valid upload_path."); > break; >- case 'UPLERR_NO_TEMP_DIR': >+ case "UPLERR_NO_TEMP_DIR": > rv = _("No temporary directory found."); > break; >- case 'UPLERR_FILE_NOT_READ': >+ case "UPLERR_FILE_NOT_READ": > rv = _("File could not be read."); > break; >- case 'UPL_FILE_DELETED': // An alert, no error >+ case "UPL_FILE_DELETED": // An alert, no error > rv = _("File has been deleted."); > break; >- case 'UPLERR_FILE_NOT_DELETED': >+ case "UPLERR_FILE_NOT_DELETED": > rv = _("File or upload record could not be deleted."); > break; > default: >@@ -469,92 +464,98 @@ > return rv; > } > function CheckSearch() { >- if( $("#term").val()=="" ) { >- alert( _("Please enter a search term.") ); >+ if ($("#term").val() == "") { >+ alert(_("Please enter a search term.")); > return false; > } > return true; > } >- function SubmitMe(op, id, msg ) { >- $("#submitter #op").val( op ); >- $("#submitter #id").val( id ); >- $("#submitter #msg").val( msg ); >+ function SubmitMe(op, id, msg) { >+ $("#submitter #op").val(op); >+ $("#submitter #id").val(id); >+ $("#submitter #msg").val(msg); > $("#submitter").submit(); > } > function DeleteEntry(id) { >- if( !confirm( _("Do you really want to delete this upload?") )) >- return false; >+ if (!confirm(_("Do you really want to delete this upload?"))) return false; > ClearField(); >- $("#form_delete #id").val( id ); >+ $("#form_delete #id").val(id); > $("#form_delete").submit(); > } > function ClearField() { >- if (plugin){ >- $(window.opener.document).find('#' + plugin_index).val( '' ); >+ if (plugin) { >+ $(window.opener.document) >+ .find("#" + plugin_index) >+ .val(""); > } > } > function Choose(hashval) { > var res = prefs.OPACBaseURL; >- res = res.replace( /\/$/, ''); >- res = res + '/cgi-bin/koha/opac-retrieve-file.pl?id=' + hashval; >+ res = res.replace(/\/$/, ""); >+ res = res + "/cgi-bin/koha/opac-retrieve-file.pl?id=" + hashval; > var index = plugin_index; >- index = index.replace( /^buttonDot_/, '' ); >- if(index) $(window.opener.document).find('#'+index).val( res ); >+ index = index.replace(/^buttonDot_/, ""); >+ if (index) >+ $(window.opener.document) >+ .find("#" + index) >+ .val(res); > window.close(); > } > >- $(document).ready(function() { >+ $(document).ready(function () { > $("#uploadresults").kohaTable({}, table_settings); > >- if (msg_alert){ >+ if (msg_alert) { > ShowAlerts(msg_alert); > } > $("#fileuploadcancel").hide(); >- $("#public_cb").click(function() { >+ $("#public_cb").click(function () { > $("#public").click(); > }); >- $("#fileuploadbutton").on("click",function(e){ >+ $("#fileuploadbutton").on("click", function (e) { > e.preventDefault(); > StartUpload(); > }); >- $("#fileuploadcancel").on("click",function(e){ >+ $("#fileuploadcancel").on("click", function (e) { > e.preventDefault(); > CancelUpload(); > }); >- $("#searchbutton").on("click",function(){ >+ $("#searchbutton").on("click", function () { > return CheckSearch(); > }); >- $("#uploadresults tbody").on("click",".choose_entry",function(e){ >+ $("#uploadresults tbody").on("click", ".choose_entry", function (e) { > e.preventDefault(); > var record_hashvalue = $(this).data("record-hashvalue"); >- Choose( record_hashvalue ); >+ Choose(record_hashvalue); > }); >- $("#uploadresults tbody").on("click",".download_entry",function(e){ >+ $("#uploadresults tbody").on("click", ".download_entry", function (e) { > e.preventDefault(); > var record_id = $(this).data("record-id"); >- SubmitMe( 'download', record_id ); >+ SubmitMe("download", record_id); > }); >- $("#uploadresults tbody").on("click",".delete_entry",function(e){ >+ $("#uploadresults tbody").on("click", ".delete_entry", function (e) { > e.preventDefault(); > var record_id = $(this).data("record-id"); >- DeleteEntry( record_id ); >+ DeleteEntry(record_id); > }); >- $("#new_search").on("click",function(e){ >+ $("#new_search").on("click", function (e) { > e.preventDefault(); >- SubmitMe('new'); >+ SubmitMe("new"); > }); > >- if ( window.isSecureContext ) { >- $(".get-file").on("click", function(e){ >+ if (window.isSecureContext) { >+ $(".get-file").on("click", function (e) { > e.preventDefault(); >- if( navigator.clipboard && navigator.clipboard.writeText){ >- navigator.clipboard.writeText( $(this).attr("href") ); >- $(this).tooltip("dispose").attr('data-bs-title', _( "Link copied to the clipboard" )).tooltip("show"); >+ if (navigator.clipboard && navigator.clipboard.writeText) { >+ navigator.clipboard.writeText($(this).attr("href")); >+ $(this).tooltip("dispose").attr("data-bs-title", _("Link copied to the clipboard")).tooltip("show"); > } > }); >- $(".get-file").tooltip().on("hidden.bs.tooltip", function(){ >- $(this).tooltip("dispose").attr("data-bs-title", _( "Copy link to this file" ) ).tooltip(); >- }); >+ $(".get-file") >+ .tooltip() >+ .on("hidden.bs.tooltip", function () { >+ $(this).tooltip("dispose").attr("data-bs-title", _("Copy link to this file")).tooltip(); >+ }); > } > }); > </script> >-- >2.43.0 >
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