From d25547c34d50c14d443540aba0b7ff888edee98c Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Date: Thu, 28 Nov 2024 16:20:24 +0100 Subject: [PATCH] Bug 38255: Replace dataTable constructor with kohaTable - Staff Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> --- .../prog/en/modules/acqui/basket.tt | 15 +- .../prog/en/modules/acqui/basketgroup.tt | 52 +++--- .../prog/en/modules/acqui/booksellers.tt | 18 +- .../prog/en/modules/acqui/invoice-files.tt | 24 +-- .../prog/en/modules/acqui/invoice.tt | 28 ++- .../prog/en/modules/acqui/invoices.tt | 18 +- .../en/modules/acqui/newordersubscription.tt | 16 +- .../en/modules/acqui/newordersuggestion.tt | 12 +- .../prog/en/modules/acqui/ordered.tt | 10 +- .../prog/en/modules/acqui/parcel.tt | 31 ++-- .../prog/en/modules/acqui/parcels.tt | 8 +- .../prog/en/modules/acqui/spent.tt | 10 +- .../prog/en/modules/acqui/supplier.tt | 10 +- .../prog/en/modules/acqui/uncertainprice.tt | 10 +- .../prog/en/modules/acqui/z3950_search.tt | 22 ++- .../en/modules/admin/additional-fields.tt | 24 ++- .../prog/en/modules/admin/aqbudgetperiods.tt | 25 +-- .../modules/admin/auth_subfields_structure.tt | 10 +- .../en/modules/admin/auth_tag_structure.tt | 10 +- .../modules/admin/branch_transfer_limits.tt | 41 ++--- .../prog/en/modules/admin/cash_registers.tt | 12 +- .../prog/en/modules/admin/credit_types.tt | 28 ++- .../prog/en/modules/admin/debit_types.tt | 28 ++- .../prog/en/modules/admin/koha2marclinks.tt | 10 +- .../prog/en/modules/admin/localization.tt | 14 +- .../en/modules/admin/marc-overlay-rules.tt | 4 +- .../prog/en/modules/admin/marctagstructure.tt | 10 +- .../prog/en/modules/admin/oai_servers.tt | 10 +- .../prog/en/modules/admin/overdrive.tt | 10 +- .../en/modules/admin/systempreferences.tt | 14 +- .../prog/en/modules/admin/z3950servers.tt | 10 +- .../prog/en/modules/catalogue/detail.tt | 12 +- .../en/modules/catalogue/search-history.tt | 16 +- .../modules/cataloguing/z3950_auth_search.tt | 14 +- .../prog/en/modules/circ/article-requests.tt | 25 +-- .../prog/en/modules/circ/checkout-notes.tt | 18 +- .../circ/circulation_batch_checkouts.tt | 16 +- .../prog/en/modules/circ/on-site_checkouts.tt | 2 +- .../prog/en/modules/circ/returns.tt | 15 +- .../prog/en/modules/circ/transfers_to_send.tt | 16 +- .../en/modules/circ/transferstoreceive.tt | 16 +- .../prog/en/modules/clubs/club-enrollments.tt | 12 +- .../prog/en/modules/clubs/clubs.tt | 26 ++- .../prog/en/modules/clubs/patron-clubs-tab.tt | 12 +- .../en/modules/labels/label-edit-batch.tt | 16 +- .../prog/en/modules/labels/label-manage.tt | 12 +- .../en/modules/members/alert-subscriptions.tt | 2 +- .../prog/en/modules/members/discharges.tt | 20 +-- .../prog/en/modules/members/notices.tt | 10 +- .../modules/members/purchase-suggestions.tt | 14 +- .../prog/en/modules/members/statistics.tt | 10 +- .../prog/en/modules/members/update-child.tt | 14 +- .../prog/en/modules/patron_lists/lists.tt | 12 +- .../modules/patron_lists/patron-lists-tab.tt | 12 +- .../prog/en/modules/patroncards/edit-batch.tt | 18 +- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 4 +- .../prog/en/modules/pos/register.tt | 8 +- .../prog/en/modules/pos/registers.tt | 8 +- .../en/modules/recalls/recalls_to_pull.tt | 18 +- .../en/modules/recalls/recalls_waiting.tt | 12 +- .../en/modules/reports/cash_register_stats.tt | 10 +- .../modules/reports/guided_reports_start.tt | 4 +- .../prog/en/modules/reports/itemtypes.tt | 10 +- .../prog/en/modules/reports/serials_stats.tt | 8 +- .../prog/en/modules/reserve/request.tt | 9 +- .../prog/en/modules/serials/claims.tt | 18 +- .../en/modules/serials/serials-collection.tt | 20 +-- .../prog/en/modules/serials/serials-search.tt | 46 ++--- .../serials/subscription-numberpatterns.tt | 10 +- .../prog/en/modules/tags/list.tt | 12 +- .../prog/en/modules/tools/access_files.tt | 10 +- .../en/modules/tools/additional-contents.tt | 18 +- .../en/modules/tools/batch_delete_records.tt | 36 ++-- .../modules/tools/batch_extend_due_dates.tt | 40 ++--- .../tools/batch_record_modification.tt | 32 ++-- .../prog/en/modules/tools/holidays.tt | 26 +-- .../en/modules/tools/manage-marc-import.tt | 4 +- .../prog/en/modules/tools/overduerules.tt | 12 +- .../prog/en/modules/tools/problem-reports.tt | 18 +- .../prog/en/modules/tools/quotes-upload.tt | 2 +- .../prog/en/modules/virtualshelves/shelves.tt | 4 +- .../intranet-tmpl/prog/js/addorderiso2709.js | 20 +-- koha-tmpl/intranet-tmpl/prog/js/authtype.js | 18 +- .../intranet-tmpl/prog/js/biblio_framework.js | 18 +- koha-tmpl/intranet-tmpl/prog/js/cart.js | 24 ++- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 2 +- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 15 +- .../prog/js/elasticsearch-mappings.js | 19 +- koha-tmpl/intranet-tmpl/prog/js/holds.js | 2 +- .../prog/js/marc_subfields_structure.js | 14 +- .../prog/js/pages/preferences.js | 17 +- .../prog/js/pages/tags-review.js | 18 +- koha-tmpl/intranet-tmpl/prog/js/recalls.js | 18 +- .../prog/js/rotating-collections.js | 18 +- .../intranet-tmpl/prog/js/subscription-add.js | 32 ++-- .../ERM/EHoldingsEBSCOTitlePackagesList.vue | 164 +++++++++--------- .../ERM/EHoldingsLocalTitlePackagesList.vue | 53 +++--- .../ERM/EHoldingsLocalTitlesFormImport.vue | 112 ++++++------ 98 files changed, 857 insertions(+), 990 deletions(-) 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 9ed74d27926..a3f13794703 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -1231,17 +1231,18 @@ $(document).ready(function() { var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'basket', 'orders', 'json' ) | $raw %]; [% IF !(Koha.Preference('EDIFACT') && ediaccount) %] + // FIXME This cannot work correctly without bKohaColumnsUseNames table_settings['columns'].splice(18, 1); [% END %] - KohaTable("orders", { - "pagingType": "full", - "autoWidth": false, - "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18[% IF (Koha.Preference('EDIFACT') && ediaccount) %],19[% END %]], + $("#orders").kohaTable({ + pagingType: "full", + autoWidth: false, + exportColumns: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18[% IF (Koha.Preference('EDIFACT') && ediaccount) %],19[% END %]], }, table_settings); - var cancelledorderst = $("#cancelledorderst").dataTable($.extend(true, {}, dataTablesDefaults, { - "pagingType": "full" - } ) ); + $("#cancelledorderst").kohaTable({ + pagingType: "full" + }); $("#reopenform").on("submit",function(e){ var skip = [% IF ( skip_confirm_reopen ) %] 1 [% ELSE %] 0 [% END %]; var is_confirmed = skip || confirm(_("Are you sure you want to reopen this basket?")); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt index ae0fa3423fc..c46aecc128e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -423,34 +423,32 @@ $("#basket_groups a[href='#opened']").tab("show"); [% END %] [% UNLESS ( grouping ) %] - $("table").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - ], - "autoWidth": false, - "pagingType": "full" - } )); + let dt_params = { + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + autoWidth: false, + pagingType: "full", + }; + $("#ungrouped").kohaTable(dt_params); + $("#grouped").kohaTable(dt_params); + $("#basket_group_opened").kohaTable(dt_params); + $("#basket_group_closed").kohaTable(dt_params); [% ELSE %] - grouped = $("#grouped").DataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], - 'autoWidth': false, - "language": { - "emptyTable": _("There are no baskets in this group") - } - } )); - ungrouped = $("#ungrouped").DataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], - 'autoWidth': false, - "language": { - "emptyTable": _("There are no ungrouped baskets") - } - } )); + grouped = $("#grouped").kohaTable({ + dom: "t", + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + autoWidth: false, + language: { + emptyTable: _("There are no baskets in this group"), + }, + }); + ungrouped = $("#ungrouped").kohaTable({ + dom: "t", + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + autoWidth: false, + language: { + emptyTable: _("There are no ungrouped baskets"), + }, + }); [% END %] $("#basketgroupcolumns").on("click", ".addtogroup", function(){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt index 5cb331c2a41..a1ac247f2b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -263,16 +263,14 @@ [% Asset.js("js/acq.js") | $raw %] <script> $(document).ready(function () { - $("table.baskets").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - paginate: false, - searching: false, - info: false, - order: [[1, "asc"]], - columnDefs: [{ targets: [-1], orderable: false }], - }) - ); + $("table.baskets").kohaTable({ + dom: "t", + paginate: false, + searching: false, + info: false, + order: [[1, "asc"]], + columnDefs: [{ targets: [-1], orderable: false }], + }); $("#supplierlist").change(function () { var id = $(this).find("option:selected").val(); window.location.href = "#vendor" + id; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt index 4d56e5b3253..588597c6724 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt @@ -116,18 +116,18 @@ [% Asset.js("js/acquisitions-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] <script> - $(document).ready(function () { - $("#invoice_files_details_table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], - info: false, - paging: false, - searching: false, - dom: "t", - }) - ); - $(".delete_file").click(function () { - return confirm(_("Are you sure you want to delete this file?")); + $(document).ready(function() { + $("#invoice_files_details_table").kohaTable({ + columnDefs: [ + { "targets": [ -1, -2 ], "orderable": false, "searchable": false } + ], + info: false, + paging: false, + searching: false, + dom: "t" + })); + $(".delete_file").click(function(){ + return ( confirm( _("Are you sure you want to delete this file?") ) ); }); }); </script> 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 80c36d5c7c3..a083d41e2e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -560,22 +560,20 @@ } $(document).ready(function() { - $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, { - "info": false, - "paging": false, - "searching": false, - "dom": "t", - "columnDefs": [ - { "type": "anti-the", "targets": [ "anti-the" ] } - ] - })); + $("#orderst").kohaTable({ + info: false, + paging: false, + searching: false, + dom: "t", + columnDefs: [{ type: "anti-the", targets: ["anti-the"] }], + }); [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %] - $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, { - "info": false, - "paging": false, - "searching": false, - "dom": "t" - })); + $("#invoice_files_table").kohaTable({ + info: false, + paging: false, + searching: false, + dom: "t", + }); [% END %] $("#show_all_details").click(function(){ updateColumnsVisibility( $(this).is(":checked") ); 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 bb62e0d7647..fb00c76613d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -498,16 +498,14 @@ }); }); - var resultst = $("table.result").dataTable( - $.extend(true, {}, dataTablesDefaults, { - paging: false, - columnDefs: [ - { orderable: false, targets: [1, -1] }, - { visible: false, targets: [0] }, - ], - autoWidth: false, - }) - ); + var resultst = $("table.result").kohaTable({ + paging: false, + columnDefs: [ + { orderable: false, targets: [1, -1] }, + { visible: false, targets: [0] }, + ], + autoWidth: false, + }); $(".show_only_subscription").prop("checked", false); 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 5ec14700a2c..f19e75f1578 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt @@ -124,15 +124,13 @@ } $(document).ready(function () { - $("#srlt").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full", - }) - ); + $("#srlt").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full", + }); $("#show_only_renewed").click(function () { updateRowsVisibility($(this).is(":checked")); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt index 62c13a176c6..e3e1c09e742 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -118,13 +118,13 @@ [% INCLUDE 'calendar.inc' %] <script> $(document).ready(function() { - var suggestionst = $("#suggestionst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ 0 ], "visible": false, "searchable": true }, // must be searchable for filtering - { "targets": [ -1 ], "orderable": false, "searchable": false }, + var suggestionst = $("#suggestionst").kohaTable({ + columnDefs: [ + { targets: [0], visible: false, searchable: true }, // must be searchable for filtering + { targets: [-1], orderable: false, searchable: false }, ], - "pagingType": "full" - })); + pagingType: "full", + }); let table_dt = suggestionst.DataTable(); $("#show_only_mine").on('click', function(e){ e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt index 73ecab4edfb..c32d9cfaa97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt @@ -120,12 +120,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#spent").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ type: "anti-the", targets: ["anti-the"] }], - pagingType: "full", - }) - ); + $("#spent").kohaTable({ + columnDefs: [{ type: "anti-the", targets: ["anti-the"] }], + pagingType: "full", + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index 9d612f1277c..890fd646692 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -369,19 +369,21 @@ }); if ( $("#receivedt").length ) { - var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, { - "stateSave": true, // We do not have table settings on this table - "pageLength": 10, - "lengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]], - "columnDefs": [ - { "targets": [ 5, -1 ], "orderable": false, "searchable": false }, + var receivedt = $("#receivedt").kohaTable({ + stateSave: true, // We do not have table settings on this table + pageLength: 10, + lengthMenu: [ + [5, 10, 20, 50, 100, -1], + [5, 10, 20, 50, 100, _("All")], ], - "columns": [ - { "type": "html" }, - { "type": "html" }, - { "type": "html" }, - { "type": "num-html" }, - { "type": "anti-the" }, + columnDefs: [{ targets: [5, -1], orderable: false, searchable: false }], + columns: [ + { type: "html" }, + { type: "html" }, + { type: "html" }, + { type: "num-html" }, + { type: "anti-the" }, + null, null, null, null, @@ -389,10 +391,9 @@ null, null, null, - null ], - "pagingType": "full" - })); + pagingType: "full", + }); } var options = { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index fdac8dc272a..81aef2a1f62 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -270,11 +270,9 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - var parcelst = $("#parcelst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - paginate: false, - }) - ); + $("#parcelst").kohaTable({ + paginate: false, + }); //keep a copy of all budgets before removing the inactives var budgetId = $("#shipmentcost_budgetid"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt index adb0602aab2..f5eeaf0037a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt @@ -130,12 +130,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#spent").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ type: "anti-the", targets: ["anti-the"] }], - pagingType: "full", - }) - ); + $("#spent").kohaTable({ + columnDefs: [{ type: "anti-the", targets: ["anti-the"] }], + pagingType: "full", + }); }); </script> [% 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 6dc116d91fb..afc1fc662d4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -687,12 +687,12 @@ } $(document).ready(function() { - var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } + var contractst = $("#contractst").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: [ 'NoSort' ] } ], - "dom": 't' - } ) ); + dom: 't' + } ); $('body').on('click', '.delete-contact', null, delete_contact); $('#add-contact').click(add_contact); $('body').on('click', '.contact_acqprimary', null, function () { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt index 68d929f4b16..3f488434aa2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt @@ -191,12 +191,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - var uncertainpricet = $("#uncertainpricet").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }], - pagingType: "full", - }) - ); + var uncertainpricet = $("#uncertainpricet").kohaTable({ + columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }], + pagingType: "full", + }); $(".check_uncertain").on("change", function () { var form = document.getElementById("uncertainprices"); var ordernumber = $(this).data("ordernumber"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt index c2ca2cd41be..0dd4640557b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt @@ -333,18 +333,16 @@ [% Asset.js("js/z3950_search.js") | $raw %] <script> $(document).ready(function () { - var resultst = $("#resultst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [-1, -2], orderable: false, searchable: false }, - { targets: [1], type: "nsb-nse" }, - ], - order: [[1, "asc"]], - paginate: false, - searching: false, - info: false, - }) - ); + var resultst = $("#resultst").kohaTable({ + columnDefs: [ + { targets: [-1, -2], orderable: false, searchable: false }, + { targets: [1], type: "nsb-nse" }, + ], + order: [[1, "asc"]], + paginate: false, + searching: false, + info: false, + }); InitLastAction(); }); </script> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt index 12771a9499d..46d8d318987 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/additional-fields.tt @@ -308,19 +308,17 @@ $("#selecttable").submit(); }); - $("#fieldst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - autoWidth: false, - dom: 't<"bottom pager"ilpf>', - pagingType: "full", - lengthMenu: [ - [10, 20, 50, 100, -1], - [10, 20, 50, 100, "All"], - ], - pageLength: 20, - order: [[0, "asc"]], - }) - ); + $("#fieldst").kohaTable({ + autoWidth: false, + dom: 't<"bottom pager"ilpf>', + pagingType: "full", + lengthMenu: [ + [10, 20, 50, 100, -1], + [10, 20, 50, 100, "All"], + ], + pageLength: 20, + order: [[0, "asc"]], + }); $("#add_field").on("submit", function () { if ($("#marcfield").length && $("select[name='authorised_value_category']").length) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt index 5b3434c8bb1..5d4b6e30f49 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt @@ -567,18 +567,19 @@ $("#budgetsTabs li:eq([% tab | html %]) a").tab("show"); [% END %] - $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - ], - "pagingType": "full", - "autoWidth": false - } ) ); + let dt_params = { + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + autoWidth: false, + }; + + $("#activeperiodst").kohaTable(dt_params); + $("#inactiveperiodst").kohaTable(dt_params); [% IF close_form %] - $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { - "dom": "t" - })); + $("#budgeth").kohaTable({ + dom: "t", + }); $("#move_form").submit(function(){ var budget_from = "[% budget_period_description | html %]"; var budget_to = $("#to_budget_period_id").find("option:selected").html(); @@ -588,7 +589,7 @@ }); [% END %] [% IF closed %] - var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, { + var oTable = $("#closed_report").kohaTable({ // The following is a c/p from aqbudgets.tt and is a candidate for refactoring. "drawCallback": function ( oSettings ) { if ( oSettings.aiDisplay.length == 0 ) @@ -624,7 +625,7 @@ "orderFixed": [[ 1, 'asc' ]], "autoWidth": false, "pagingType": "full_numbers" - })); + }); [% END %] $("#add_modify_budget").validate({ rules: { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt index ab4e6ea47ab..c70e790a6bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt @@ -437,13 +437,11 @@ [% Asset.js("js/admin-menu.js") | $raw %] <script> $(document).ready(function() { - $("#table_authsubfieldstructure").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], + $("#table_authsubfieldstructure").kohaTable({ + columnDefs: [{ sortable: false, targets: ["NoSort"] }], aaSorting: [], - paginate: false - })); + paginate: false, + }); if ($("#subfieldtabs").length > 0) { [% IF ( tagsubfield && tagsubfield == "@") %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt index b2fa0dcaa35..0c7ca26927d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_tag_structure.tt @@ -289,12 +289,10 @@ [% Asset.js("js/admin-menu.js") | $raw %] <script> $(document).ready(function () { - $("#table_authtagstructure").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - pagingType: "full", - }) - ); + $("#table_authtagstructure").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt index 032204c70f4..a81080c0e6e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt @@ -135,54 +135,55 @@ [% Asset.js("js/admin-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] <script> - $(document).ready(function () { - $("#CheckAll").on("click", function (e) { + $(document).ready(function(){ + $("#CheckAll").on("click", function(e){ e.preventDefault(); - $(".cb").each(function () { + $(".cb").each(function(){ $(this).prop("checked", true); }); }); - $("#UncheckAll").on("click", function (e) { + $("#UncheckAll").on("click", function(e){ e.preventDefault(); - $(".cb").each(function () { + $(".cb").each(function(){ $(this).prop("checked", false); }); }); - if ($("#transferlimit_tabs .tab-pane.active").length < 1) { - $("#transferlimit_tabs a:first").tab("show"); + if( $("#transferlimit_tabs .tab-pane.active").length < 1 ){ + $("#transferlimit_tabs a:first").tab("show"); } - $("#branchselect").change(function () { - $("#selectlibrary").submit(); - }); + $('#branchselect').change(function() { + $('#selectlibrary').submit(); + }); var checkall = $(".checkall"); var uncheckall = $(".uncheckall"); - $(checkall).on("click", function (e) { + $(checkall).on("click", function(e){ e.preventDefault(); var tid = $(this).data("cb"); - $(".cb" + tid).each(function () { + $(".cb" + tid ).each(function(){ $(this).prop("checked", true); - }); + }) }); - $(uncheckall).on("click", function (e) { + $(uncheckall).on("click", function(e){ e.preventDefault(); var tid = $(this).data("cb"); - $(".cb" + tid).each(function () { + $(".cb" + tid ).each(function(){ $(this).prop("checked", false); - }); + }) }); - $(".sorted").dataTable( - $.extend(true, {}, dataTablesDefaults, { + + [% FOREACH codes_loo IN codes_loop %] + $("#[% codes_loo.code | html %]table").kohaTable({ columnDefs: [{ targets: [-1], orderable: false, searchable: false }], paginate: false, - }) - ); + }); + [% END %] }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt index 009a63e20bf..486ddf1eeec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cash_registers.tt @@ -253,13 +253,11 @@ } $(document).ready(function () { - var crtable = $("#table_cash_registers").DataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], - order: [[1, "asc"]], - paginationType: "full", - }) - ); + var crtable = $("#table_cash_registers").kohaTable({ + columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], + order: [[1, "asc"]], + paginationType: "full", + }); $("#branch_filter").on("change", function () { // Table must be filtered by the <option>'s text, not its value diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt index 0dbf8966fcb..04fe052dc51 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/credit_types.tt @@ -241,21 +241,19 @@ $(document).ready(function () { var txtActivefilter = _("Filter system credit types"); var txtInactivefilter = _("Show all credit types"); - var table_credit_types = $("#table_credit_types").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [-1], orderable: false, searchable: false }, - { targets: [0, 1], orderable: false, visible: false }, - ], - order: [ - [0, "asc"], - [2, "asc"], - ], - dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>', - pageLength: 20, - pagingType: "full_numbers", - }) - ); + var table_credit_types = $("#table_credit_types").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { targets: [0, 1], orderable: false, visible: false }, + ], + order: [ + [0, "asc"], + [2, "asc"], + ], + dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>', + pageLength: 20, + pagingType: "full_numbers", + }); $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>"); $("#filter_system").click(function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt index 1666160f112..dbe0198abee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -257,21 +257,19 @@ $(document).ready(function () { var txtActivefilter = _("Filter system debit types"); var txtInactivefilter = _("Show all debit types"); - var table_debit_types = $("#table_debit_types").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [-1], orderable: false, searchable: false }, - { targets: [0, 1], orderable: false, visible: false }, - ], - order: [ - [0, "asc"], - [2, "asc"], - ], - dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>', - pageLength: 20, - pagingType: "full_numbers", - }) - ); + var table_debit_types = $("#table_debit_types").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { targets: [0, 1], orderable: false, visible: false }, + ], + order: [ + [0, "asc"], + [2, "asc"], + ], + dom: 'C<"top pager"ilpfB><"#filter_s">tr<"bottom pager"ip>', + pageLength: 20, + pagingType: "full_numbers", + }); $("#filter_s").html('<p><a href="#" id="filter_system"><i class="fa fa-filter"></i> ' + txtActivefilter + "</a>"); $("#filter_system").click(function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt index ea64ed97729..2b8a8749c1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt @@ -108,12 +108,10 @@ } } $(document).ready(function () { - $("#kohafields").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - paging: false, - }) - ); + $("#kohafields").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + paging: false, + }); $(".addfld").on("click", function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt index 89f4f1bb8a0..bb8f2e1f2b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/localization.tt @@ -198,14 +198,12 @@ $(document).ready(function() { $(".dialog").hide(); - var table = $("#localization").DataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], - "paginate": false, - 'autoWidth': false, - })); + var table = $("#localization").kohaTable({ + dom: "t", + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + paginate: false, + autoWidth: false, + }); var languages_select = $('<select name="lang" id="lang"></select>'); [% FOR language IN languages %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt index 4b460c1a378..afd9a028d82 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-overlay-rules.tt @@ -393,7 +393,7 @@ }); } - $('#marc-overlay-rules').dataTable($.extend(true, {}, dataTablesDefaults, { + $('#marc-overlay-rules').kohaTable({ "columns": [ {"searchable": false, "orderable": false}, {"orderDataType": "dom-input"}, @@ -408,7 +408,7 @@ {"searchable": false, "orderable": false} ], "pagingType": "simple" - })); + }); var overlay_rules_presets = {}; overlay_rules_presets["protect"] = { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt index fc1f3e85051..1f744523223 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt @@ -325,12 +325,10 @@ [% Asset.js("js/admin-menu.js") | $raw %] <script> $(document).ready(function () { - $("#table_marctagstructure").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - pagingType: "full", - }) - ); + $("#table_marctagstructure").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + }); $("#select_display").on("change", function () { var checked = $(this).prop("checked") ? 1 : 0; Cookies.set("marctagstructure_selectdisplay", checked, { sameSite: "Lax" }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt index 2bf043c88dc..96da4bddb5d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_servers.tt @@ -212,12 +212,10 @@ }); [% ELSE %] $(document).ready(function() { - $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], - "pagingType": "full", - })); + $("#serverst").kohaTable({ + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + pagingType: "full", + }); $(".delete").on("click",function(e){ var servername = $(this).data("servername"); let formid = $(this).data("formid"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt index 16c3148e5aa..85996f704ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt @@ -72,12 +72,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#od_info").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - pagingType: "full", - }) - ); + $("#od_info").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt index cd7936b44a0..7064999c523 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt @@ -495,13 +495,13 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function() { - [% IF ( loop ) %]$("#sysprefst").dataTable($.extend(true, {}, dataTablesDefaults, { - "dom": '<"top pager"ilf>t', - "columnDefs": [ - { "targets": [ -1, -2, -3 ], "orderable": false } - ], - "paginate": false - }));[% END %] + [% IF ( loop ) %] + $("#sysprefst").kohaTable({ + dom: '<"top pager"ilf>t', + columnDefs: [{ targets: [-1, -2, -3], orderable: false }], + paginate: false, + }); + [% END %] }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt index cac044ecf34..d354bd7d140 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt @@ -318,12 +318,10 @@ } [% ELSE %] $(document).ready(function() { - $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [-1], "orderable": false, "searchable": false }, - ], - "pagingType": "full" - })); + $("#serverst").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + }); $(".delete").on("click",function(e){ var servername = $(this).data("servername"); let formid = $(this).data("formid"); 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 f67a973da80..c901585fb02 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -2081,13 +2081,13 @@ [% END %] [% IF suggestions.count %] - $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }, - { "type": "anti-the", "targets": [ "anti-the" ] } + $("#suggestions").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, ], - "pagingType": "full" - })); + pagingType: "full", + }); [% END %] [% IF ( reviews ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt index 8a1b840c8df..71b58cb314e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt @@ -222,13 +222,11 @@ $(document).ready(function () { // We show table ordered by descending dates by default // (so that the more recent query is shown first) - $(".historyt").dataTable( - $.extend(true, {}, dataTablesDefaults, { - order: [[1, "desc"]], - columnDefs: [{ targets: [0], orderable: false, searchable: false }], - pagingType: "full_numbers", - }) - ); + $(".historyt").kohaTable({ + order: [[1, "desc"]], + columnDefs: [{ targets: [0], orderable: false, searchable: false }], + pagingType: "full_numbers", + }); // DataTables removes hidden rows from the DOM, so we can't expect a // "regular" submit to work and we need to build another form containing @@ -237,7 +235,7 @@ e.preventDefault(); var form = $(this); - var table = form.find("table").dataTable(); + var table = form.find("table").kohaTable(); var new_form = $("<form>").attr("action", form.attr("action")).attr("method", form.attr("method")); form.find('input[type="hidden"]') @@ -275,7 +273,7 @@ $(".action_delete").click(function (e) { e.preventDefault(); var form = $(this).parents("form").first(); - var table = form.find("table").dataTable(); + var table = form.find("table").kohaTable(); var ids = $("input:checkbox:checked", table); if ($(ids).length < 1) { return false; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt index 68e3ae421f0..7995ae68383 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt @@ -265,14 +265,12 @@ [% Asset.js("js/z3950_search.js") | $raw %] <script> $(document).ready(function () { - $("#resultst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - order: [[1, "asc"]], - paginate: false, - }) - ); + $("#resultst").kohaTable({ + dom: "t", + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + order: [[1, "asc"]], + paginate: false, + }); InitLastAction(); }); </script> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt index 5b5db413417..63ad4ee8d67 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt @@ -574,22 +574,15 @@ if( link.length > 0 ) link[0].focus(); }); - requested_datatable = $("#article-requests-requested-table").DataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [0, -1], "orderable": false, "searchable": false }, - ], - })); - - pending_datatable = $("#article-requests-pending-table").DataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [0, -1], "orderable": false, "searchable": false }, - ], - })); - processing_datatable = $("#article-requests-processing-table").DataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [0, -1], "orderable": false, "searchable": false }, - ], - })); + requested_datatable = $("#article-requests-requested-table").kohaTable({ + columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }], + }); + pending_datatable = $("#article-requests-pending-table").kohaTable({ + columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }], + }); + processing_datatable = $("#article-requests-processing-table").kohaTable({ + columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }], + }); active_datatable = requested_datatable; activateBatchActions( active_tab ); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt index 1fc47b62eb5..3da5fce04f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt @@ -120,16 +120,14 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#notestable").dataTable( - $.extend(true, {}, dataTablesDefaults, { - order: [[1, "asc"]], - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full", - }) - ); + $("#notestable").kohaTable({ + order: [[1, "asc"]], + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full", + }); $(".SelectAll").on("click", function () { $("input[name='issue_ids'][type='checkbox']").prop("checked", true); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index fad1991e9c5..f57663ed664 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -359,15 +359,15 @@ } else if ($('#checkoutrenew').length) { $('#checkoutrenew').focus(); } - $("#checkout_infos").dataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "order": [], - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }, - { "type": "anti-the", "targets": [ "anti-the" ] } + $("#checkout_infos").kohaTable({ + dom: "t", + order: [], + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, ], - "paginate": false - })); + paginate: false, + }); }); // On-site batch checkout function toggle_onsite_checkout(){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt index 6ea6638dafd..bb315fd622f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/on-site_checkouts.tt @@ -80,7 +80,7 @@ <script> $(document).ready(function () { if ($("#pending_onsite_checkout").length) { - $("#pending_onsite_checkout").dataTable($.extend(true, {}, dataTablesDefaults)); + $("#pending_onsite_checkout").kohaTable(); } }); </script> 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 39c7500712e..5af5b9b8952 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -1706,12 +1706,15 @@ }); }); - $('#items-bundle-contents-table').dataTable($.extend(true, {}, dataTablesDefaults, { - "searching": false, - "paginate": false, - "info": false, - "order": [[ 1, 'asc' ], [ 0, 'asc' ]] - })); + $("#items-bundle-contents-table").kohaTable({ + searching: false, + paginate: false, + info: false, + order: [ + [1, "asc"], + [0, "asc"], + ], + }); [% IF ( !(Koha.Preference('TransfersBlockCirc')) && Koha.Preference('AutomaticConfirmTransfer') ) %] $("#wrong-transfer-modal").on('hidden.bs.modal',function(){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt index 4b204fb8251..f9782743276 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transfers_to_send.tt @@ -99,14 +99,14 @@ <script> $(document).ready(function() { [% FOREACH library IN libraries %] - $("#transferst[% library.branchcode | html %]").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - { "type": "anti-the", "targets": [ "anti-the" ] } - ], - "dom": 't', - "paginate": false - })); + $("#transferst[% library.branchcode | html %]").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { type: "anti-the", targets: ["anti-the"] }, + ], + dom: "t", + paginate: false, + }); [% END %] }); </script> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt index f757bf9f7fc..d656d9eef02 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt @@ -114,14 +114,14 @@ <script> $(document).ready(function() { [% FOREACH branchesloo IN branchesloop %] - $("#transferst[% branchesloo.branchcode | html %]").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - { "type": "anti-the", "targets": [ "anti-the" ] } - ], - "dom": 't', - "paginate": false - })); + $("#transferst[% branchesloo.branchcode | html %]").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { type: "anti-the", targets: ["anti-the"] }, + ], + dom: "t", + paginate: false, + }); [% END %] }); </script> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt index 8c3d0c58ba0..63c804d03fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt @@ -93,13 +93,11 @@ [% Asset.js("js/tools-menu.js") | $raw %] <script> $(document).ready(function () { - eTable = $("#enrollments-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - pagingType: "full", - dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', - columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], - }) - ); + eTable = $("#enrollments-table").kohaTable({ + pagingType: "full", + dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', + columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt index 644ce4969df..809c6bcf286 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt @@ -148,21 +148,17 @@ [% Asset.js("js/tools-menu.js") | $raw %] <script> $(document).ready(function () { - tTable = $("#club-templates-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - pagingType: "full", - dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - }) - ); - - cTable = $("#clubs-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - pagingType: "full", - dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - }) - ); + tTable = $("#club-templates-table").kohaTable({ + pagingType: "full", + dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + }); + + cTable = $("#clubs-table").kohaTable({ + pagingType: "full", + dom: 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>', + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + }); $("body").on("click", ".delete_club", function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt index b2e2c5bc37e..2b93945b9c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt @@ -59,12 +59,12 @@ </table> [% END %] <script> - $("#table_clubnoenrollmemnts, #table_clubenrollments").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { 'sortable': false, 'targets': [ 'NoSort' ] } - ], - paginate: true - })); + let dt_params = { + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + paginate: true, + }; + $("#table_clubnoenrollmemnts").kohaTable(dt_params); + $("#table_clubenrollments").kohaTable(dt_params); [% IF CAN_user_clubs_enroll %] function loadEnrollmentForm( id, enrollent_id = 0 ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt index 7ad4c2c534b..b78fe120b3a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt @@ -345,15 +345,15 @@ [% ELSE %] $("#description").hide(); [% END %] - $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { - "autoWidth": false, - "columnDefs": [ - { "type": "anti-the", "targets": [ "anti-the" ] }, - { "targets": [ -1, -2 ], "orderable": false, "searchable": false }, + $("#batcht").kohaTable({ + autoWidth: false, + columnDefs: [ + { type: "anti-the", targets: ["anti-the"] }, + { targets: [-1, -2], orderable: false, searchable: false }, ], - "order": [[ 0, "asc" ]], - "pagingType": "full" - })); + order: [[0, "asc"]], + pagingType: "full", + }); $("#additems").click(function(){ Add(); return false; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt index e2ab002b54f..cdf72bcf293 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt @@ -216,13 +216,11 @@ $(".delete").on("click", function(){ return confirmDelete( _("Are you sure you want to delete this?") ); }); - $("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, { - "pagingType": "full", - "order": [[ 1, "asc" ]], - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - ] - })); + $("#labels-table").kohaTable({ + pagingType: "full", + order: [[1, "asc"]], + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/alert-subscriptions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/alert-subscriptions.tt index e239cb4860a..0415742472e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/alert-subscriptions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/alert-subscriptions.tt @@ -94,7 +94,7 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#subscriptions").dataTable($.extend(true, {}, dataTablesDefaults, {})); + $("#subscriptions").kohaTable(); $(".unsubscribe").submit(function () { var patron = $(this).data("patron"); var title = $(this).data("title"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt index da528487475..dc1cc33008d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt @@ -71,16 +71,16 @@ [% INCLUDE 'datatables.inc' %] <script> - $(document).ready(function () { - $("#pending_updates table").DataTable( - $.extend(true, {}, dataTablesDefaults, { - paging: false, - info: true, - searching: true, - order: [[2, "asc"]], - columnDefs: [{ targets: -1, orderable: false }], - }) - ); + $(document).ready(function() { + $('#pending_updates table').kohaTable({ + paging: false, + info: true, + searching: true, + order: [[2, "asc"]], + columnDefs: [ + { targets: -1, orderable: false } + ], + )); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt index 1cacdb14ab4..b72be92c869 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -182,12 +182,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#noticestable").dataTable( - $.extend(true, {}, dataTablesDefaults, { - order: [[3, "desc"]], - pagingType: "full", - }) - ); + $("#noticestable").kohaTable({ + order: [[3, "desc"]], + pagingType: "full", + }); $("#noticestable").on("click", ".notice-title", function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt index 3d0e067dcf7..c18c22fe562 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt @@ -135,14 +135,12 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#suggestions").dataTable( - $.extend(true, {}, dataTablesDefaults, { - paginate: false, - searching: false, - info: false, - dom: "t", - }) - ); + $("#suggestions").kohaTable({ + paginate: false, + searching: false, + info: false, + dom: "t", + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt index 043687feffa..bd9a999add9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt @@ -104,12 +104,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#statistics").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - paginate: false, - }) - ); + $("#statistics").kohaTable({ + dom: "t", + paginate: false, + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt index 3403a229bfe..a3a5d9fcac2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt @@ -65,14 +65,12 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#catst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - order: [[2, "asc"]], - columnDefs: [{ targets: [0], orderable: false, searchable: false }], - paginate: false, - }) - ); + $("#catst").kohaTable({ + dom: "t", + order: [[2, "asc"]], + columnDefs: [{ targets: [0], orderable: false, searchable: false }], + paginate: false, + }); $("#updatechildf").validate({ rules: { catcode: { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt index e57afd75095..45e9af808a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt @@ -148,13 +148,11 @@ let selectedPatronLists = new Array(); - $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, { - "autoWidth": false, - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] } - ], - "pagingType": "full" - } )); + $("#patron-lists-table").kohaTable({ + autoWidth: false, + columnDefs: [{ orderable: false, searchable: false, targets: ["NoSort"] }], + pagingType: "full", + }); $(".delete_patron").on("click", function(){ $(".dropdown").removeClass("open"); var list = $(this).data("list-name"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt index c65e12d58da..9c66142955b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/patron-lists-tab.tt @@ -111,12 +111,12 @@ </div> [% END %] <script> - $("#table_listnopatron, #table_inlists").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { 'sortable': false, "bSearchable": false, 'targets': [ 'NoSort' ] } - ], - "sPaginationType": "full" - })); + let dt_params = { + columnDefs: [{ sortable: false, bSearchable: false, targets: ["NoSort"] }], + sPaginationType: "full", + }; + $("#table_listnopatron").kohaTable(dt_params); + $("#table_inlists").kohaTable(dt_params); [% IF CAN_user_tools_manage_patron_lists %] function addToList() { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index a93d32465d1..bf30dfc3568 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -308,16 +308,14 @@ [% ELSE %] $("#description").hide(); [% END %] - $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -2, -1 ], "orderable": false, "searchable": false } - ], - "order": [[ 0, "asc" ]], - "pagingType": "full", - "lengthMenu": [aLengthMenu, aLengthMenuLabel], - "pageLength": patronsPerPage, - "autoWidth": false - })); + $("#batcht").kohaTable({ + columnDefs: [{ targets: [-2, -1], orderable: false, searchable: false }], + order: [[0, "asc"]], + pagingType: "full", + lengthMenu: [aLengthMenu, aLengthMenuLabel], + pageLength: patronsPerPage, + autoWidth: false, + }); $("#additems").click(function(){ return Add(); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index ef615a516f0..124d7f05660 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -336,7 +336,7 @@ $(document).ready(function() { const sale_table = document.getElementById('sale'); - const saleDataTable = $("#sale").DataTable($.extend(true, {}, dataTablesDefaults, { + const saleDataTable = $("#sale").kohaTable({ "paginate": false, "searching": false, "info": false, @@ -385,7 +385,7 @@ $('#paid').val(total_price).trigger('change'); }, "autoWidth": false - })); + }); $("#sale").on("click", "button.drop", function(){ saleDataTable.row($(this).parents('tr')).remove().draw(false); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt index 5a7a740b94b..5bc606a0a77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -439,7 +439,7 @@ [% Asset.js("js/modal_printer.js") | $raw %] [% INCLUDE 'calendar.inc' %] <script> - var sales_table = $("#sales").dataTable($.extend(true, {}, dataTablesDefaults, { + var sales_table = $("#sales").kohaTable({ orderFixed: [ 0, 'asc'], ordering: false, columnDefs: [ { @@ -464,9 +464,9 @@ initComplete: function() { $("#sales").show(); } - })); + }); - var past_sales_table = $("#past_sales").dataTable($.extend(true, {}, dataTablesDefaults, { + var past_sales_table = $("#past_sales").kohaTable({ orderFixed: [ 0, 'asc'], ordering: false, columnDefs: [ { @@ -486,7 +486,7 @@ }, endRender: null, } - })); + }); $("#issueRefundModal").on("shown.bs.modal", function(e){ var button = $(e.relatedTarget); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt index 79eebe1dece..dc3fef87a5c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -215,10 +215,10 @@ $("#income").text('[% ctotal | $Price %] ([% cctotal | $Price %])'); $("#outgoing").text('[% dtotal | $Price %] ([% cdtotal | $Price %])'); - var registers_table = $("#registers").dataTable($.extend(true, {}, dataTablesDefaults, { - "searching": false, - "paginationType": "full" - })); + var registers_table = $("#registers").kohaTable({ + searching: false, + paginationType: "full", + }); $("#confirmCashupModal").on("shown.bs.modal", function(e){ var button = $(e.relatedTarget); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt index 5df3b0cd831..69b7714b1e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_to_pull.tt @@ -152,16 +152,14 @@ [% INCLUDE 'columns_settings.inc' %] <script> $(document).ready(function () { - $("#recalls-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, targets: ["nosort"] }, - { type: "title-string", targets: ["title-string"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full_numbers", - }) - ); + $("#recalls-table").kohaTable({ + columnDefs: [ + { orderable: false, targets: ["nosort"] }, + { type: "title-string", targets: ["title-string"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full_numbers", + }); $(".cancelreturn").click(function () { return confirmDelete(_("Are you sure you want to remove this recall and return the item to its home library?")); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt index 4f05c0a54d1..3e2f8c6e2ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/recalls_waiting.tt @@ -157,13 +157,11 @@ [% INCLUDE 'columns_settings.inc' %] <script> $(document).ready(function () { - $("#recallswaiting-table, #recallsover-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - autoWidth: false, - columnDefs: [{ orderable: false, targets: ["nosort"] }], - pagingType: "full_numbers", - }) - ); + $("#recallswaiting-table, #recallsover-table").kohaTable({ + autoWidth: false, + columnDefs: [{ orderable: false, targets: ["nosort"] }], + pagingType: "full_numbers", + }); $(".revert_recall").click(function (e) { return confirmDelete(_("Are you sure you want to revert this recall's status from Waiting?")); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt index 8a6ebea6647..8c6a87a9022 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cash_register_stats.tt @@ -204,12 +204,10 @@ <script> actTotal = ""; $(document).ready(function () { - $("#tbl_cash_register_stats").dataTable( - $.extend(true, {}, dataTablesDefaults, { - pageLength: 50, - pagingType: "full_numbers", - }) - ); + $("#tbl_cash_register_stats").kohaTable({ + pageLength: 50, + pagingType: "full_numbers", + }); $("#branch").on("change", function () { var selectedBranch = $("#branch").children("option:selected").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 5d294db2ec6..6f337fe120c 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 @@ -2539,7 +2539,7 @@ $(".mana_search_status").hide(); $("#mana_search_result_label").text(_("Results from Mana Knowledge Base")); $("#mana-loading").hide(); - $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{ + $("#mana_results_datatable").kohaTable({ "pagingType": "full", "autoWidth": false, "columnDefs": [ @@ -2549,7 +2549,7 @@ { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }, { "type": "anti-the", "targets": [ 'anti-the'] } ] - })); + }); $(".showbutton").on("click", function(e){ e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt index 19978f90969..498cfcfa497 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt @@ -99,12 +99,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#itemtypest").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - paginate: false, - }) - ); + $("#itemtypest").kohaTable({ + dom: "t", + paginate: false, + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt index 682d7bb3219..63ab0a5c9fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.tt @@ -147,11 +147,9 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#resulttable").dataTable( - $.extend(true, {}, dataTablesDefaults, { - paginate: false, - }) - ); + $("#resulttable").kohaTable({ + paginate: false, + }); }); </script> [% END %] 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 4b74435b508..7f76c4f89fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1508,11 +1508,10 @@ }); [% END %] - var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, { - "paginate": false, - "dom": '<"top pager"ilf>t', - })); - + var my_table = $("#requestspecific").kohaTable({ + paginate: false, + dom: '<"top pager"ilf>t', + }); $("#club-request-form").on("submit", function() { let $t = $(this); 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 cd5a788257e..d16381bfb93 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt @@ -217,16 +217,14 @@ <script> var sTable; $(document).ready(function () { - sTable = $("#claimst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - columnDefs: [ - { targets: [0], orderable: false, searchable: false }, - { type: "anti-the", targets: ["anti-the"] }, - ], - paginate: false, - }) - ); + sTable = $("#claimst").kohaTable({ + dom: "t", + columnDefs: [ + { targets: [0], orderable: false, searchable: false }, + { type: "anti-the", targets: ["anti-the"] }, + ], + paginate: false, + }); $("#supplierid").change(function () { $("#claims").submit(); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 147139d984c..67c39806aae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -359,17 +359,15 @@ if( $("#subscription_years .tab-pane.active").length < 1 ){ $("#subscription_years a:first").tab("show"); } - $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ 0,-1 ], "orderable": false, "searchable": false } - ], - "order": [[0, 'desc']], - "dom": 't', - "autoWidth": false, - "paginate": false, - "info": false, - "searching": false, - } )); + $(".subscription-year-table").kohaTable({ + columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }], + order: [[0, "desc"]], + dom: "t", + autoWidth: false, + paginate: false, + info: false, + searching: false, + }); $(".CheckAll").on("click", function(e){ e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index a62ed79046e..500f5a62c51 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -334,32 +334,32 @@ } $(document).ready(function() { - var osrlt = $("#opened_panel table").dataTable($.extend(true, {}, dataTablesDefaults, { - "pagingType": "full", - "order": [[ 2, "asc" ]], - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }, - { "type": "anti-the", "targets": [ 'anti-the'] } - ] - })); + var osrlt = $("#opened_panel table").kohaTable({ + pagingType: "full", + order: [[2, "asc"]], + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + }); - var csrlt = $("#closed_panel table").dataTable($.extend(true, {}, dataTablesDefaults, { + var csrlt = $("#closed_panel table").kohaTable({ // FIXME sort function of additional_fields! - "order": [[ 2, "asc" ]], - "pagingType": "full", - "columnDefs": [ - { "orderable": false, "targets": [ 'NoSort' ] }, - { "type": "anti-the", "targets": [ 'anti-the'] } - ] - })); + order: [[2, "asc"]], + pagingType: "full", + columnDefs: [ + { orderable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + }); - var manarlt = $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, { - "pagingType": "full", - "columnDefs": [ - { "orderable": false, "searchable": false, "targets": [ 'NoSort' ] }, - { "type": "anti-the", "targets": [ 'anti-the'] } - ] - })); + var manarlt = $("#mana_results_datatable").kohaTable({ + pagingType: "full", + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + }); $("#reopensub").click(function(){ return confirm(_("Are you sure you want to reopen this subscription?")); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt index 0c38f7d276d..64217e7a9a1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt @@ -390,12 +390,10 @@ } $(document).ready(function(){ - $("#numberpatternst").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ -1 ], "orderable": false, "searchable": false }, - ], - "pagingType": "full" - })); + $("#numberpatternst").kohaTable({ + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + pagingType: "full", + }); $(".delete_pattern").on("click",function(){ return confirmDelete(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt index 593b0b6d8e1..33c4676fab3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt @@ -159,13 +159,11 @@ event.preventDefault(); } }); - $("#itemst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], - order: [[0, "asc"]], - pagingType: "full", - }) - ); + $("#itemst").kohaTable({ + columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }], + order: [[0, "asc"]], + pagingType: "full", + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt index 18e044fff3f..beccfa42524 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/access_files.tt @@ -67,12 +67,10 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#files").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: [-1], orderSequence: ["desc", "asc"], searchable: false }], - paginate: false, - }) - ); + $("#files").kohaTable({ + columnDefs: [{ targets: [-1], orderSequence: ["desc", "asc"], searchable: false }], + paginate: false, + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 74870644201..0a87a700ac7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -604,16 +604,14 @@ }); $(document).ready(function () { - var table = $("#table_additional_contents").DataTable( - $.extend(true, {}, dataTablesDefaults, { - order: [[4, "desc"]], - columnDefs: [ - { sortable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full_numbers", - }) - ); + var table = $("#table_additional_contents").kohaTable({ + order: [[4, "desc"]], + columnDefs: [ + { sortable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full_numbers", + }); $("#del_form").on("click", ".delete_news", function (e) { e.preventDefault(); 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 b27d561aee0..c325868b00d 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 @@ -346,25 +346,25 @@ }); [% END %] - $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ 0 ], "orderable": false, "searchable": false }, - { "targets": [ 3, 4 ], "type": "num-html" } - ], - "dom": 't', - "order": [], - "paginate": false - })); + $("#biblios").kohaTable({ + columnDefs: [ + { targets: [0], orderable: false, searchable: false }, + { targets: [3, 4], type: "num-html" }, + ], + dom: "t", + order: [], + paginate: false, + }); - $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [ 0 ], "orderable": false, "searchable": false }, - { "targets": [ 3 ], "type": "num-html" } - ], - "dom": 't', - "order": [], - "paginate": false - })); + $("#authorities").kohaTable({ + columnDefs: [ + { targets: [0], orderable: false, searchable: false }, + { targets: [3], type: "num-html" }, + ], + dom: "t", + order: [], + paginate: false, + }); $("#selectrecords").on("submit",function(){ var nb_checked = $("#selectrecords").find("input[type='checkbox'][name='record_id']:checked").size(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt index 6702c348b3b..e4188a8edc8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_extend_due_dates.tt @@ -267,29 +267,25 @@ $("#selectall").click(); - $("#checkouts").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [0, 3], orderable: false, searchable: false }, - { targets: [1], type: "num-html" }, - ], - dom: "t", - order: [], - paginate: false, - }) - ); + $("#checkouts").kohaTable({ + columnDefs: [ + { targets: [0, 3], orderable: false, searchable: false }, + { targets: [1], type: "num-html" }, + ], + dom: "t", + order: [], + paginate: false, + }); - $("#checkouts_result").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [0, 3], orderable: false, searchable: false }, - { targets: [1], type: "num-html" }, - ], - dom: "t", - order: [], - paginate: false, - }) - ); + $("#checkouts_result").kohaTable({ + columnDefs: [ + { targets: [0, 3], orderable: false, searchable: false }, + { targets: [1], type: "num-html" }, + ], + dom: "t", + order: [], + paginate: false, + }); $("#extend_due_dates_form").on("submit", function (e) { var new_hard_due_date = $("#new_hard_due_date").val(); 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 984e8f090ba..d61e04840aa 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 @@ -353,25 +353,25 @@ $("#selectall").click(); - $("table#biblios").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [0, 3], "orderable": false, "searchable": false }, - { "targets": [1], "type": "num-html" } + $("#biblios").kohaTable({ + columnDefs: [ + { targets: [0, 3], orderable: false, searchable: false }, + { targets: [1], type: "num-html" }, ], - "dom": 't', - "order": [], - "paginate": false - })); + dom: "t", + order: [], + paginate: false, + }); - $("table#authorities").dataTable($.extend(true, {}, dataTablesDefaults, { - "columnDefs": [ - { "targets": [0, 3], "orderable": false, "searchable": false }, - { "targets": [1], "type": "num-html" } + $("#authorities").kohaTable({ + columnDefs: [ + { targets: [0, 3], orderable: false, searchable: false }, + { targets: [1], type: "num-html" }, ], - "dom": 't', - "order": [], - "paginate": false - })); + dom: "t", + order: [], + paginate: false, + }); $("#mainformsubmit").click(function() { if ($("input[type=checkbox][name='record_id']:checked").length == 0) { 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 65cf99194fa..b6877639cf5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt @@ -608,20 +608,24 @@ var first_td = $(this).find('td').first(); first_td.html(weekdays[first_td.html()]); }); - $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "paginate": false - })); - var tables = $("#holidayexceptions, #holidaysyearlyrepeatable, #holidaysunique").DataTable($.extend(true, {}, dataTablesDefaults, { - "dom": 't', - "paginate": false, - "createdRow": function( row, data, dataIndex ) { + $("#holidayweeklyrepeatable").kohaTable({ + dom: "t", + paginate: false, + }); + + let dt_params = { + dom: "t", + paginate: false, + createdRow: function (row, data, dataIndex) { var holiday = $(row).data("date"); - if( holiday < datestring ){ + if (holiday < datestring) { $(row).addClass("date_past"); } - } - })); + }, + }; + $("#holidayexceptions").kohaTable(dt_params); + $("#holidaysyearlyrepeatable").kohaTable(dt_params); + $("#holidaysunique").kohaTable(dt_params); $(".show_past").on("change", function(){ tables.draw(); 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 e3f38155b01..86dd59d3780 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 @@ -470,7 +470,7 @@ }); [% IF import_batch_id %] - $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, { + $("#records-table").kohaTable({ "autoWidth": false, "searching": false, "processing": true, @@ -596,7 +596,7 @@ ); } }, - })); + }); $("#revert_batch_form").on("submit", function() { return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt index b720bcf85e7..094feee82fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt @@ -188,13 +188,11 @@ if ($("#rulestabs .tab-pane.active").length < 1) { $("#rulestabs a:first").tab("show"); } - $(".overduerulest").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ targets: ["NoSort"], orderable: false, searchable: false }], - dom: '<"top pager"f>rt<"clear">', - paginate: false, - }) - ); + $(".overduerulest").kohaTable({ + columnDefs: [{ targets: ["NoSort"], orderable: false, searchable: false }], + dom: '<"top pager"f>rt<"clear">', + paginate: false, + }); $("#overduerulesf").on("submit", function (e) { $(".overduerulest").DataTable().search("").draw(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt index a06557a65c2..2141d41132d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/problem-reports.tt @@ -142,16 +142,14 @@ [% INCLUDE 'datatables.inc' %] <script> $(document).ready(function () { - $("#problemreportstable").dataTable( - $.extend(true, {}, dataTablesDefaults, { - order: [[1, "asc"]], - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full", - }) - ); + $("#problemreportstable").kohaTable({ + order: [[1, "asc"]], + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full", + }); $(".SelectAll").on("click", function () { $("input[name='report_ids'][type='checkbox']").prop("checked", true); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt index 8f6c458abed..687a4f6923f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/quotes-upload.tt @@ -242,7 +242,7 @@ $("#quotes_editor").show(); $("#save_quotes").on("click", yuiGetData); - let table = $("#quotes_editor").dataTable({ + let table = $("#quotes_editor").kohaTable({ autoWidth: false, paging: true, ordering: false, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 5bed02084e9..0001ca5d2ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -659,7 +659,7 @@ 'vs.lastmodified', ]; - var dtListResults = $("#listresultst").dataTable($.extend(true, {}, dataTablesDefaults, { + var dtListResults = $("#listresultst").kohaTable({ order: [[ 5, "asc" ]], serverSide: true, ajax: { @@ -697,7 +697,7 @@ "searching": false, "processing": true, "orderCellsTop": true - })); + }); _dt_add_delay_filters(dtListResults.api(), $("#listresultst")); /* Select correct tab based on URL parameter */ diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js index 4d3ba2eb024..cd999e95064 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js +++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js @@ -1,17 +1,15 @@ -/* global dataTablesDefaults __ template_path */ +/* global __ template_path */ $(document).ready(function () { $("#Aform").preventDoubleFormSubmit(); - $("#files").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full", - order: [], - }) - ); + $("#files").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full", + order: [], + }); checkOrderBudgets(); var all_budget_id = $("#all_budget_id"); diff --git a/koha-tmpl/intranet-tmpl/prog/js/authtype.js b/koha-tmpl/intranet-tmpl/prog/js/authtype.js index 9b2c22c00a1..0c5501c9107 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/authtype.js +++ b/koha-tmpl/intranet-tmpl/prog/js/authtype.js @@ -3,16 +3,14 @@ var importing = false; $(document).ready(function () { - $("#authtypes").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [-1], orderable: false, searchable: false }, - { targets: [0, 1], type: "natural" }, - ], - ordering: true, - pagingType: "full", - }) - ); + $("#authtypes").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { targets: [0, 1], type: "natural" }, + ], + ordering: true, + pagingType: "full", + }); $("body").css("cursor", "auto"); $(".import_export_options").hide(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js index a030485278e..56be1c4905b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js +++ b/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js @@ -4,16 +4,14 @@ var importing = false; $(document).ready(function () { - $("#table_biblio_frameworks").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { targets: [-1], orderable: false, searchable: false }, - { targets: [0, 1], type: "natural" }, - ], - ordering: true, - pagingType: "full", - }) - ); + $("#table_biblio_frameworks").kohaTable({ + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + { targets: [0, 1], type: "natural" }, + ], + ordering: true, + pagingType: "full", + }); $("body").css("cursor", "auto"); $(".import_export_options").hide(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/cart.js b/koha-tmpl/intranet-tmpl/prog/js/cart.js index bd723eea3c7..2a483f1fc45 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cart.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cart.js @@ -1,4 +1,4 @@ -/* global __ dataTablesDefaults showMore showLess delSelRecords addSelToShelf sendBasket printBasket delBasket openBiblio selRecord */ +/* global __ showMore showLess delSelRecords addSelToShelf sendBasket printBasket delBasket openBiblio selRecord */ function placeHold() { var checkedItems = $("input:checkbox:checked"); @@ -94,18 +94,16 @@ $(document).ready(function () { $(".hold").text(__("Place hold")); $("#downloadcartc").empty(); - $("#itemst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - { type: "callnumbers", targets: ["callnumbers"] }, - ], - order: [[1, "asc"]], - paging: false, - }) - ); + $("#itemst").kohaTable({ + dom: "t", + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + { type: "callnumbers", targets: ["callnumbers"] }, + ], + order: [[1, "asc"]], + paging: false, + }); $(".showdetails").on("click", function (e) { e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 3e25f13ae52..88af9c08d8e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -1380,7 +1380,7 @@ $(document).ready(function () { } function loadReturnClaimsTable() { if (!returnClaimsTable) { - returnClaimsTable = $("#return-claims-table").dataTable({ + returnClaimsTable = $("#return-claims-table").kohaTable({ autoWidth: false, dom: "rt", order: [], diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 65aea7733d0..d6708910f22 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -1260,22 +1260,29 @@ function _dt_save_restore_state(table_settings, external_filter_nodes = {}) { }; } + if (options.ajax) { + options.ajax = Object.assign( + {}, + options.ajax, + _dt_default_ajax({ default_filters, options }) + ); + options.serverSide = true; + options.processing = true; + options.pagingType = "full_numbers"; + } + settings = $.extend( true, {}, dataTablesDefaults, { paging: true, - serverSide: true, searching: true, - pagingType: "full_numbers", - processing: true, language: { emptyTable: options.emptyTable ? options.emptyTable : __("No data available in table"), }, - ajax: _dt_default_ajax({ default_filters, options }), }, options ); diff --git a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js index b9cd8e522fb..65d9bd18f8e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js @@ -1,4 +1,4 @@ -/* global __ dataTablesDefaults */ +/* global __ */ function clean_line(line) { $(line).find('input[type="text"]').val(""); @@ -52,16 +52,13 @@ function tableInit(oldtabid, newtabid) { oldTableId.DataTable().destroy(); } - var newTableId = $("#" + newtabid + "_table"); - newTableId.DataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - ], - paging: false, - autoWidth: false, - }) - ); + $("#" + newtabid + "_table").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + ], + paging: false, + autoWidth: false, + }); } $(document).ready(function () { diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 7d1ec9e92b3..06b373be1fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -105,7 +105,7 @@ function display_pickup_location(state) { }; })(jQuery); -/* global __ dataTablesDefaults borrowernumber SuspendHoldsIntranet */ +/* global __ borrowernumber SuspendHoldsIntranet */ $(document).ready(function () { function suspend_hold(hold_id, end_date) { var params; diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js index e3401cc95c0..f1b4cf8c5c6 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js +++ b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js @@ -1,4 +1,4 @@ -/* global dataTablesDefaults tagsubfield selectBsTabByHash */ +/* global tagsubfield selectBsTabByHash */ $(document).ready(function () { if (tagsubfield && tagsubfield == "@") { $("#subfieldtabs a[href='#AT_panel']").tab("show"); @@ -29,13 +29,11 @@ $(document).ready(function () { $("input[id^='hidden-']").each(function () { populateHiddenCheckboxes($(this).attr("id").split("-")[1]); }); - $("#table_marcsubfieldstructure").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [{ sortable: false, targets: ["NoSort"] }], - order: [], - paginate: false, - }) - ); + $("#table_marcsubfieldstructure").kohaTable({ + columnDefs: [{ sortable: false, targets: ["NoSort"] }], + order: [], + paginate: false, + }); selectBsTabByHash("subfieldtabs"); }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index 14271370903..8330df19e7d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -1,4 +1,5 @@ -/* global KOHA CodeMirror to_highlight search_jumped humanMsg dataTablesDefaults themelang */ +/* keep tidy */ +/* global KOHA CodeMirror to_highlight search_jumped humanMsg themelang */ // We can assume 'KOHA' exists, as we depend on KOHA.AJAX KOHA.Preferences = { @@ -207,14 +208,12 @@ function addConsentDeleteHandler() { }); } -$("table.preferences").dataTable( - $.extend(true, {}, dataTablesDefaults, { - dom: "t", - columnDefs: [{ targets: [-1], orderable: false, searchable: false }], - paging: false, - fixedHeader: false, - }) -); +$("table.preferences").kohaTable({ + dom: "t", + columnDefs: [{ targets: [-1], orderable: false, searchable: false }], + paging: false, + fixedHeader: false, +}); $(".prefs-tab") .find("input.preference, textarea.preference") diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js index d7aaa67ccbe..67b68b7dec5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js @@ -74,16 +74,14 @@ var success_test_call = function () { }; $(document).ready(function () { - $("#tagst").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, searchable: false, targets: ["NoSort"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - order: [[2, "desc"]], - pagingType: "full", - }) - ); + $("#tagst").kohaTable({ + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + order: [[2, "desc"]], + pagingType: "full", + }); $(".ajax_buttons").css({ visibility: "visible" }); $("p.check").html( '<div id="searchheader"><a id="CheckAll" href="/cgi-bin/koha/tags/review.pl"><i class="fa fa-check" aria-hidden="false"><\/i> ' + diff --git a/koha-tmpl/intranet-tmpl/prog/js/recalls.js b/koha-tmpl/intranet-tmpl/prog/js/recalls.js index 7dad7285ea3..0833d181f3c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/recalls.js +++ b/koha-tmpl/intranet-tmpl/prog/js/recalls.js @@ -127,16 +127,14 @@ $(document).ready(function () { } }); - $("#recalls-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - columnDefs: [ - { orderable: false, targets: ["nosort"] }, - { type: "title-string", targets: ["title-string"] }, - { type: "anti-the", targets: ["anti-the"] }, - ], - pagingType: "full_numbers", - }) - ); + $("#recalls-table").kohaTable({ + columnDefs: [ + { orderable: false, targets: ["nosort"] }, + { type: "title-string", targets: ["title-string"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + pagingType: "full_numbers", + }); $("#cancel_selected").click(function (e) { if ($("input[name='recall_ids']:checked").length > 0) { diff --git a/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js index 4a60364cfce..e7c94152dc1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js +++ b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js @@ -1,4 +1,4 @@ -/* global _ dataTablesDefaults */ +/* global _ */ $(document).ready(function () { $("#barcode").focus(); @@ -21,14 +21,12 @@ $(document).ready(function () { }); if ($("#rotating-collections-table").length > 0) { - $("#rotating-collections-table").dataTable( - $.extend(true, {}, dataTablesDefaults, { - autoWidth: false, - columnDefs: [ - { targets: [-1], orderable: false, searchable: false }, - ], - pagingType: "full", - }) - ); + $("#rotating-collections-table").kohaTable({ + autoWidth: false, + columnDefs: [ + { targets: [-1], orderable: false, searchable: false }, + ], + pagingType: "full", + }); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js index dbd0942bc0f..76aded3f56c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -556,25 +556,19 @@ function mana_search() { $("#mana_search_result_label").text( __("Results from Mana Knowledge Base") ); - $("#mana_results_datatable").dataTable( - $.extend(true, {}, dataTablesDefaults, { - pagingType: "full", - order: [ - [4, "desc"], - [5, "desc"], - ], - autoWidth: false, - columnDefs: [{ width: "35%", targets: 1 }], - columnDefs: [ - { - orderable: false, - searchable: false, - targets: ["NoSort"], - }, - { type: "anti-the", targets: ["anti-the"] }, - ], - }) - ); + $("#mana_results_datatable").kohaTable({ + pagingType: "full", + order: [ + [4, "desc"], + [5, "desc"], + ], + autoWidth: false, + columnDefs: [{ width: "35%", targets: 1 }], + columnDefs: [ + { orderable: false, searchable: false, targets: ["NoSort"] }, + { type: "anti-the", targets: ["anti-the"] }, + ], + }); if ( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0 diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue index fef480ba7b9..b8536d245f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue @@ -89,97 +89,89 @@ export default { $.fn.dataTable.ext.search = $.fn.dataTable.ext.search.filter( search => search.name != "apply_filter" ); - $("#" + table_id).dataTable({ - ...dataTablesDefaults, - ...{ - data: resources, - embed: ["package.name"], - ordering: false, - dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', - lengthMenu: [ - [10, 20, 50, 100], - [10, 20, 50, 100], - ], - autoWidth: false, - columns: [ - { - title: __("Name"), - data: "package.name", - searchable: false, - orderable: false, - render: function (data, type, row, meta) { - // Rendering done in drawCallback - return ""; - }, - width: "100%", + $("#" + table_id).kohaTable({ + data: resources, + embed: ["package.name"], + ordering: false, + dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', + lengthMenu: [ + [10, 20, 50, 100], + [10, 20, 50, 100], + ], + autoWidth: false, + columns: [ + { + title: __("Name"), + data: "package.name", + searchable: false, + orderable: false, + render: function (data, type, row, meta) { + // Rendering done in drawCallback + return ""; }, - ], - drawCallback: function (settings) { - var api = new $.fn.dataTable.Api(settings); + width: "100%", + }, + ], + drawCallback: function (settings) { + var api = new $.fn.dataTable.Api(settings); - if (!api.rows({ search: "applied" }).count()) return; + if (!api.rows({ search: "applied" }).count()) return; - $.each( - $(this).find("tbody tr td:first-child"), - function (index, e) { - let tr = $(this).parent(); - let row = api.row(tr).data(); - if (!row) return; // Happen if the table is empty - let { href } = router.resolve({ - name: "EHoldingsEBSCOResourcesShow", - params: { resource_id: row.resource_id }, - }); - let n = createVNode( - "a", - { - role: "button", - href, - onClick: e => { - e.preventDefault(); - show_resource(row.resource_id); - }, + $.each( + $(this).find("tbody tr td:first-child"), + function (index, e) { + let tr = $(this).parent(); + let row = api.row(tr).data(); + if (!row) return; // Happen if the table is empty + let { href } = router.resolve({ + name: "EHoldingsEBSCOResourcesShow", + params: { resource_id: row.resource_id }, + }); + let n = createVNode( + "a", + { + role: "button", + href, + onClick: e => { + e.preventDefault(); + show_resource(row.resource_id); }, - `${row.package.name}` - ); - if (row.is_selected) { - n = createVNode("span", {}, [ - n, - " ", - createVNode("i", { - class: "fa fa-check-square", - style: { - color: "green", - float: "right", - }, - title: __("Is selected"), - }), - ]); - } - render(n, e); - } - ); - }, - initComplete: function () { - $.fn.dataTable.ext.search.push( - function apply_filter( - settings, - data, - dataIndex, - row - ) { - return ( - row.package.name.match( - new RegExp(filters.package_name, "i") - ) && - (filters.selection_type == 0 || - (filters.selection_type == 1 && - row.is_selected) || - (filters.selection_type == 2 && - !row.is_selected)) - ); + }, + `${row.package.name}` + ); + if (row.is_selected) { + n = createVNode("span", {}, [ + n, + " ", + createVNode("i", { + class: "fa fa-check-square", + style: { + color: "green", + float: "right", + }, + title: __("Is selected"), + }), + ]); } - ); - }, + render(n, e); + } + ); + }, + initComplete: function () { + $.fn.dataTable.ext.search.push( + function apply_filter(settings, data, dataIndex, row) { + return ( + row.package.name.match( + new RegExp(filters.package_name, "i") + ) && + (filters.selection_type == 0 || + (filters.selection_type == 1 && + row.is_selected) || + (filters.selection_type == 2 && + !row.is_selected)) + ); + } + ); }, }); }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue index b510189ef15..c96fe78e3fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlePackagesList.vue @@ -5,36 +5,35 @@ </template> <script> -import { createVNode, render } from "vue"; -import { useDataTable } from "../../composables/datatables"; +import { createVNode, render } from "vue" +import { useDataTable } from "../../composables/datatables" export default { setup() { - const table_id = "package_list"; - useDataTable(table_id); + const table_id = "package_list" + useDataTable(table_id) return { table_id, - }; + } }, data() { - return {}; + return {} }, methods: { show_resource: function (resource_id) { this.$router.push({ name: "EHoldingsLocalResourcesShow", params: { resource_id }, - }); + }) }, build_datatable: function () { - let show_resource = this.show_resource; - let router = this.$router; - let resources = this.resources; - let table_id = this.table_id; + let show_resource = this.show_resource + let router = this.$router + let resources = this.resources + let table_id = this.table_id - $("#" + table_id).dataTable( - $.extend(true, {}, dataTablesDefaults, { + $("#" + table_id).kohaTable({ data: resources, embed: ["package.name"], order: [[0, "asc"]], @@ -47,52 +46,52 @@ export default { orderable: true, render: function (data, type, row, meta) { // Rendering done in drawCallback - return ""; + return "" }, width: "100%", }, ], drawCallback: function (settings) { - var api = new $.fn.dataTable.Api(settings); + var api = new $.fn.dataTable.Api(settings) $.each( $(this).find("tbody tr td:first-child"), function (index, e) { - let tr = $(this).parent(); - let row = api.row(tr).data(); - if (!row) return; // Happen if the table is empty + let tr = $(this).parent() + let row = api.row(tr).data() + if (!row) return // Happen if the table is empty let { href } = router.resolve({ name: "EHoldingsLocalResourcesShow", params: { resource_id: row.resource_id }, - }); + }) let n = createVNode( "a", { role: "button", href, onClick: e => { - e.preventDefault(); - show_resource(row.resource_id); + e.preventDefault() + show_resource(row.resource_id) }, }, `${row.package.name}` - ); - render(n, e); + ) + render(n, e) } - ); + ) }, }) - ); + ) }, }, mounted() { - this.build_datatable(); + this.build_datatable() }, props: { resources: Array, }, name: "EHoldingsLocalTitlePackagesList", -}; +} </script> <style scoped> diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormImport.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormImport.vue index 8ca683869c6..8251ec63b40 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormImport.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesFormImport.vue @@ -82,70 +82,62 @@ export default { let lists = this.logged_in_user_lists; let table_id = this.table_id; let import_from_list = this.import_from_list; - $("#" + table_id).dataTable( - $.extend(true, {}, dataTablesDefaults, { - data: lists, - order: [[0, "asc"]], - autoWidth: false, - columns: [ - { - title: __("Name"), - data: "shelfname", - searchable: true, - orderable: true, - width: "100%", - render: function (data, type, row, meta) { - return ( - row.shelfname + - " (#" + - row.shelfnumber + - ")" - ); - }, + $("#" + table_id).kohaTable({ + data: lists, + order: [[0, "asc"]], + autoWidth: false, + columns: [ + { + title: __("Name"), + data: "shelfname", + searchable: true, + orderable: true, + width: "100%", + render: function (data, type, row, meta) { + return ( + row.shelfname + " (#" + row.shelfnumber + ")" + ); }, - { - title: __("Actions"), - data: function (row, type, val, meta) { - return '<div class="actions"></div>'; - }, - className: "actions noExport", - searchable: false, - orderable: false, + }, + { + title: __("Actions"), + data: function (row, type, val, meta) { + return '<div class="actions"></div>'; }, - ], - drawCallback: function (settings) { - var api = new $.fn.dataTable.Api(settings); - - $.each( - $(this).find("td .actions"), - function (index, e) { - let tr = $(this).parent().parent(); - let list_id = api.row(tr).data().shelfnumber; - let importButton = createVNode( - "a", - { - class: "btn btn-default btn-xs", - role: "button", - onClick: () => { - import_from_list(list_id); - }, - }, - [ - createVNode("i", { - class: "fa fa-download", - "aria-hidden": "true", - }), - __("Import"), - ] - ); + className: "actions noExport", + searchable: false, + orderable: false, + }, + ], + drawCallback: function (settings) { + var api = new $.fn.dataTable.Api(settings); - let n = createVNode("span", {}, [importButton]); - render(n, e); - } + $.each($(this).find("td .actions"), function (index, e) { + let tr = $(this).parent().parent(); + let list_id = api.row(tr).data().shelfnumber; + let importButton = createVNode( + "a", + { + class: "btn btn-default btn-xs", + role: "button", + onClick: () => { + import_from_list(list_id); + }, + }, + [ + createVNode("i", { + class: "fa fa-download", + "aria-hidden": "true", + }), + __("Import"), + ] ); - }, - }) - ); + + let n = createVNode("span", {}, [importButton]); + render(n, e); + }); + }, + }); }, }, mounted() { -- 2.34.1