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 9ed74d2792..a3f1379470 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 ae0fa3423f..c46aecc128 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 5cb331c2a4..a1ac247f2b 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 %] 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 80c36d5c7c..a083d41e2e 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 bb62e0d764..fb00c76613 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 5ec14700a2..f19e75f157 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 62c13a176c..e3e1c09e74 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' %] [% 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 9d612f1277..890fd64669 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 fdac8dc272..81aef2a1f6 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' %] [% 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 6dc116d91f..afc1fc662d 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 68d929f4b1..3f488434aa 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' %] 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 12771a9499..46d8d31898 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 5b3434c8bb..5d4b6e30f4 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 ab4e6ea47a..c70e790a6b 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 %] [% 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 032204c70f..a81080c0e6 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' %] [% 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 009a63e20b..486ddf1eee 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