From c3e6c3b717cf4aac70cd2387023e771d9ce5eb2e Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 28 Jan 2025 11:32:21 +0100
Subject: [PATCH] Bug 38984: Add NoSort when can replace targets

In those occurrences we can simply use NoSort. It fixes some bugs, where
the display of the column depends on some pref's values

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
---
 .../prog/en/includes/clubs-table.inc           |  2 +-
 .../prog/en/modules/acqui/basketgroup.tt       |  5 ++---
 .../prog/en/modules/acqui/booksellers.tt       |  3 +--
 .../prog/en/modules/acqui/invoices.tt          |  5 ++---
 .../en/modules/acqui/newordersuggestion.tt     |  3 +--
 .../prog/en/modules/acqui/parcel.tt            |  5 ++---
 .../prog/en/modules/acqui/z3950_search.tt      |  5 ++---
 .../prog/en/modules/admin/aqbudgetperiods.tt   |  5 ++---
 .../en/modules/admin/auth_tag_structure.tt     |  3 +--
 .../en/modules/admin/branch_transfer_limits.tt |  3 +--
 .../prog/en/modules/admin/cash_registers.tt    |  5 ++---
 .../prog/en/modules/admin/koha2marclinks.tt    |  3 +--
 .../prog/en/modules/admin/marctagstructure.tt  |  3 +--
 .../prog/en/modules/admin/overdrive.tt         |  3 +--
 .../prog/en/modules/admin/systempreferences.tt |  7 +++----
 .../prog/en/modules/admin/z3950servers.tt      |  3 +--
 .../en/modules/catalogue/search-history.tt     |  9 ++++-----
 .../modules/cataloguing/z3950_auth_search.tt   |  3 +--
 .../prog/en/modules/circ/article-requests.tt   | 18 ++++++------------
 .../prog/en/modules/circ/transfers_to_send.tt  |  5 +----
 .../prog/en/modules/circ/transferstoreceive.tt |  5 +----
 .../prog/en/modules/clubs/clubs.tt             |  4 +---
 .../prog/en/modules/labels/label-manage.tt     |  3 +--
 .../prog/en/modules/members/discharges.tt      |  5 +----
 .../prog/en/modules/members/update-child.tt    |  3 +--
 .../prog/en/modules/patroncards/edit-batch.tt  |  5 ++---
 .../prog/en/modules/serials/claims.tt          |  5 +----
 .../en/modules/serials/serials-collection.tt   |  5 ++---
 .../serials/subscription-numberpatterns.tt     |  3 +--
 .../intranet-tmpl/prog/en/modules/tags/list.tt |  5 ++---
 .../en/modules/tools/batch_delete_records.tt   |  6 ++----
 .../modules/tools/batch_record_modification.tt | 10 ++++------
 .../bootstrap/en/modules/opac-basket.tt        |  5 ++---
 .../bootstrap/en/modules/opac-idref.tt         |  5 ++---
 .../bootstrap/en/modules/opac-illrequests.tt   |  3 +--
 .../bootstrap/en/modules/opac-readingrecord.tt |  1 -
 .../en/modules/opac-search-history.tt          |  3 +--
 .../bootstrap/en/modules/opac-tags.tt          |  3 +--
 38 files changed, 62 insertions(+), 115 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc
index ccf055d465..be54c959c8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc
@@ -17,7 +17,7 @@
             <th>End date</th>
             <th>Enrolled patrons</th>
             [% UNLESS destination == 'holds' %]
-                <th>&nbsp;</th>
+                <th class="NoSort">&nbsp;</th>
             [% END %]
         </tr>
     </thead>
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 16ef90cef4..ef9ce3f051 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
@@ -261,7 +261,7 @@
                                             <th>Billing place</th>
                                             <th>Delivery place</th>
                                             <th>Number of baskets</th>
-                                            <th>Action</th>
+                                            <th class="NoSort">Action</th>
                                         </tr>
                                     </thead>
                                     <tbody>
@@ -313,7 +313,7 @@
                                             <th>Billing place</th>
                                             <th>Delivery place</th>
                                             <th>Number of baskets</th>
-                                            <th>Action</th>
+                                            <th class="NoSort">Action</th>
                                         </tr>
                                     </thead>
                                     <tbody>
@@ -401,7 +401,6 @@
             [% END %]
             [% UNLESS ( grouping ) %]
                 let dt_params = {
-                    columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                     autoWidth: false,
                     pagingType: "full",
                 };
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 68b3aa0727..df91cfcd35 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
@@ -134,7 +134,7 @@
                                     <th>Basket group</th>
                                     <th>Internal note</th>
                                     <th>Closed</th>
-                                    <th class="noExport">Actions</th>
+                                    <th class="noExport NoSort">Actions</th>
                                 </tr>
                             </thead>
                             <tbody>
@@ -270,7 +270,6 @@
                 searching: false,
                 info: false,
                 order: [[1, "asc"]],
-                columnDefs: [{ targets: [-1], orderable: false }],
             });
             $("#supplierlist").change(function() {
                 var id = $(this).find("option:selected").val();
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 c7c8767165..d2c3869580 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
@@ -59,7 +59,7 @@
                                         [% IF CAN_user_acquisition_merge_invoices %]
                                             <th>&nbsp;</th>
                                         [% END %]
-                                        <th>&nbsp;</th>
+                                        <th class="NoSort">&nbsp;</th>
                                         <th>Invoice number</th>
                                         <th>Vendor</th>
                                         <th>Shipment date</th>
@@ -67,7 +67,7 @@
                                         <th>Received bibliographic records</th>
                                         <th>Received items</th>
                                         <th>Status</th>
-                                        <th>&nbsp;</th>
+                                        <th class="NoSort">&nbsp;</th>
                                     </tr>
                                 </thead>
                                 <tbody>
@@ -444,7 +444,6 @@
             var resultst = $("table.result").kohaTable({
                 paging: false,
                 columnDefs: [
-                    { orderable: false, targets: [1, -1] },
                     { visible: false, targets: [0] },
                 ],
                 autoWidth: false,
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 24e4a81a36..6c19dc286b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt
@@ -61,7 +61,7 @@
                     <th>Price</th>
                     <th>Quantity</th>
                     <th>Total</th>
-                    <th>&nbsp;</th>
+                    <th class="NoSort">&nbsp;</th>
                 </tr>
                 </thead>
                 <tbody>
@@ -135,7 +135,6 @@
         var suggestionst = $("#suggestionst").kohaTable({
             columnDefs: [
                 { targets: [0], visible: false, searchable: true }, // must be searchable for filtering
-                { targets: [-1], orderable: false, searchable: false },
             ],
             pagingType: "full",
         });
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 ca4c147929..e532563ee1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
@@ -163,14 +163,14 @@
           <th>Order line</th>
           <th title="Item holds / Total holds">Holds</th>
           <th>Summary</th>
-          <th>More</th>
+          <th class="NoSort">More</th>
           <th>Replacement price</th>
           <th>Quantity</th>
           <th>Fund</th>
           <th>Est cost</th>
           <th>Actual cost</th>
           <th>TOTAL</th>
-          <th></th>
+          <th class="NoSort"></th>
         </tr>
       </thead>
     <tfoot>
@@ -380,7 +380,6 @@
                         [5, 10, 20, 50, 100, -1],
                         [5, 10, 20, 50, 100, _("All")],
                     ],
-                    columnDefs: [{ targets: [5, -1], orderable: false, searchable: false }],
                     columns: [
                         { type: "html" },
                         { type: "html" },
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 efe32a7ea8..3a72980148 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
@@ -187,9 +187,9 @@ tr.selected td {
         <th>ISBN</th>
         <th>LCCN</th>
         [% IF ( Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' ) %]
-            <th>Additional fields</th>
+            <th class="NoSort">Additional fields</th>
         [% END %]
-        <th>Actions</th>
+        <th class="NoSort">Actions</th>
     </tr></thead>
     <tbody>[% FOREACH breeding_loo IN breeding_loop %]
         [% IF ( breeding_loo.breedingid ) %]
@@ -315,7 +315,6 @@ tr.selected td {
         $(document).ready(function(){
             var resultst = $("#resultst").kohaTable({
                 columnDefs: [
-                    { targets: [-1, -2], orderable: false, searchable: false },
                     { targets: [1], type: "nsb-nse" },
                 ],
                 order: [[1, "asc"]],
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 26266bfc0f..430fa6870a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
@@ -477,7 +477,7 @@
                                 <th>End date</th>
                                 <th>Locked</th>
                                 <th>Total</th>
-                                <th class="noExport">Actions</th>
+                                <th class="noExport NoSort">Actions</th>
                             </tr>
                         </thead>
                         <tbody>
@@ -514,7 +514,7 @@
                                 <th>End date</th>
                                 <th>Locked</th>
                                 <th>Total</th>
-                                <th class="noExport">Actions</th>
+                                <th class="noExport NoSort">Actions</th>
                             </tr>
                         </thead>
                         <tbody>
@@ -566,7 +566,6 @@
             [% END %]
 
             let dt_params = {
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 pagingType: "full",
                 autoWidth: false,
             };
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 cc0348e086..f557928cb4 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
@@ -254,7 +254,7 @@
             <th>Repeatable</th>
             <th>Mandatory</th>
             <th>Authorized<br />value</th>
-            <th>&nbsp;</th>
+            <th class="NoSort">&nbsp;</th>
         </tr>
     </thead>
     <tbody>
@@ -300,7 +300,6 @@
     <script>
         $(document).ready(function() {
             $("#table_authtagstructure").kohaTable({
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 pagingType: "full",
             });
         });
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 9b4ed3760e..ea5a043e6e 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
@@ -79,7 +79,7 @@
                         <thead>
                             <tr>
                                 <th>Library</th>
-                                <th>Allow transfer?</th>
+                                <th class="NoSort">Allow transfer?</th>
                             </tr>
                         </thead>
 
@@ -171,7 +171,6 @@
 
             [% FOREACH codes_loo IN codes_loop %]
                 $("#[% codes_loo.code | html %]table").kohaTable({
-                    columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                     paginate: false,
                 });
             [% 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 d7c1381d1d..f2344b181b 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
@@ -175,8 +175,8 @@
                            <th>Description</th>
                            <th>Library</th>
                            <th>Library default</th>
-                           <th>Initial float</th>
-                           <th class="noExport">Actions</th>
+                           <th class="NoSort">Initial float</th>
+                           <th class="noExport NoSort">Actions</th>
                        </thead>
                        <tbody>
                        [% FOREACH cash_register IN cash_registers %]
@@ -249,7 +249,6 @@
     <script>
     $(document).ready(function() {
         var crtable = $("#table_cash_registers").kohaTable({
-            columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
             order: [[1, "asc"]],
             paginationType: "full",
         });
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 c441a92c75..08744844a3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt
@@ -51,7 +51,7 @@
     <th>Tag</th>
     <th>Subfield</th>
     <th>Lib</th>
-    <th>&nbsp;</th>
+    <th class="NoSort">&nbsp;</th>
 </tr></thead>
 <tbody>
 [% FOREACH loo IN loop %]
@@ -115,7 +115,6 @@
         }
         $(document).ready(function() {
             $("#kohafields").kohaTable({
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 paging: false,
             });
 
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 b2fc6a5e49..09f7c3fe99 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt
@@ -253,7 +253,7 @@
         <th>Auth value</th>
         <th>Indicator 1</th>
         <th>Indicator 2</th>
-        <th>&nbsp;</th>
+        <th class="NoSort">&nbsp;</th>
         </tr>
     </thead>
     <tbody>
@@ -313,7 +313,6 @@
     <script>
         $(document).ready(function() {
             $("#table_marctagstructure").kohaTable({
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 pagingType: "full",
             });
             $("#select_display").on("change",function(){
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 b22e9ff3b2..cf9e6d0b77 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/overdrive.tt
@@ -47,7 +47,7 @@
                             <thead>
                                 <tr>
                                     <th>Library</th>
-                                    <th>Authname</th>
+                                    <th class="NoSort">Authname</th>
                                 </tr>
                             </thead>
                             <tbody>
@@ -86,7 +86,6 @@
     <script>
         $(document).ready(function() {
             $("#od_info").kohaTable({
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 pagingType: "full",
             });
         });
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 d78688e701..3622f7ff5c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt
@@ -319,9 +319,9 @@
         <table id="sysprefst">
         <thead><tr>
         <th>Preference</th>
-        <th>Explanation</th>
-        <th>Value</th>
-        <th class="noExport">Actions</th>
+        <th class="NoSort">Explanation</th>
+        <th class="NoSort">Value</th>
+        <th class="noExport NoSort">Actions</th>
         </tr></thead>
     [% END %]
     <tbody>[% FOREACH loo IN loop %]
@@ -466,7 +466,6 @@
                 [% IF ( loop ) %]
                     $("#sysprefst").kohaTable({
                         dom: '<"top pager"ilf>t',
-                        columnDefs: [{ targets: [-1, -2, -3], orderable: false }],
                         paginate: false,
                     });
                 [% 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 cc3d290806..a274d6dcce 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
@@ -224,7 +224,7 @@
     <div class="page-section">
     <table id="serverst">
 
-        <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th class="noExport">Actions</th>
+        <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th class="noExport NoSort">Actions</th>
         </tr></thead>
         <tbody>
         [% FOREACH loo IN loop %]
@@ -328,7 +328,6 @@
         [% ELSE %]
             $(document).ready(function() {
                 $("#serverst").kohaTable({
-                    columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                     pagingType: "full",
                 });
                 $(".delete").on("click",function(e){
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 a80908043e..2ed17ac8fe 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
@@ -63,7 +63,7 @@
                                 <table class="historyt">
                                     <thead>
                                         <tr>
-                                            <th></th>
+                                            <th class="NoSort"></th>
                                             <th>Date</th>
                                             <th>Search</th>
                                             <th>Results</th>
@@ -105,7 +105,7 @@
                                 <table class="historyt">
                                     <thead>
                                         <tr>
-                                            <th></th>
+                                            <th class="NoSort"></th>
                                             <th>Date</th>
                                             <th>Search</th>
                                             <th>Results</th>
@@ -149,7 +149,7 @@
                                 <table class="historyt">
                                     <thead>
                                         <tr>
-                                            <th></th>
+                                            <th class="NoSort"></th>
                                             <th>Date</th>
                                             <th>Search</th>
                                             <th>Results</th>
@@ -191,7 +191,7 @@
                                 <table class="historyt">
                                     <thead>
                                         <tr>
-                                            <th></th>
+                                            <th class="NoSort"></th>
                                             <th>Date</th>
                                             <th>Search</th>
                                             <th>Results</th>
@@ -230,7 +230,6 @@
         // (so that the more recent query is shown first)
         $(".historyt").kohaTable({
             order: [[1, "desc"]],
-            columnDefs: [{ targets: [0], orderable: false, searchable: false }],
             pagingType: "full_numbers",
         });
 
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 c181ffcfac..49b8330ed2 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
@@ -87,7 +87,7 @@
         [% IF Koha.Preference('AdditionalFieldsInZ3950ResultAuthSearch') %]
             <th>Additional fields</th>
         [% END %]
-        <th class="noExport">Actions</th>
+        <th class="noExport NoSort">Actions</th>
     </tr></thead>
     <tbody>[% FOREACH breeding_loo IN breeding_loop %]
         [% IF ( breeding_loo.breedingid ) %]
@@ -236,7 +236,6 @@
         $(document).ready(function(){
             $("#resultst").kohaTable({
                 dom: "t",
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 order: [[1, "asc"]],
                 paginate: false,
             });
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 82d7321447..20c77c6791 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
@@ -219,7 +219,7 @@
                                         <th class="ar-urls">URLs</th>
                                         <th class="ar-patron">Patron</th>
                                         <th class="ar-date">Date</th>
-                                        <th class="ar-actions noExport">Actions</th>
+                                        <th class="ar-actions noExport NoSort">Actions</th>
                                     </tr>
                                 </thead>
 
@@ -326,7 +326,7 @@
                                         <th class="ar-urls">URLs</th>
                                         <th class="ar-patron">Patron</th>
                                         <th class="ar-date">Date</th>
-                                        <th class="ar-actions noExport">Actions</th>
+                                        <th class="ar-actions noExport NoSort">Actions</th>
                                     </tr>
                                 </thead>
 
@@ -432,7 +432,7 @@
                                         <th class="ar-urls">URLs</th>
                                         <th class="ar-patron">Patron</th>
                                         <th class="ar-date">Date</th>
-                                        <th class="ar-actions noExport">Actions</th>
+                                        <th class="ar-actions noExport NoSort">Actions</th>
                                     </tr>
                                 </thead>
 
@@ -582,15 +582,9 @@
                 if( link.length > 0 ) link[0].focus();
             });
 
-            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 }],
-            });
+            requested_datatable = $("#article-requests-requested-table").kohaTable();
+            pending_datatable = $("#article-requests-pending-table").kohaTable();
+            processing_datatable = $("#article-requests-processing-table").kohaTable();
             active_datatable = requested_datatable;
             activateBatchActions( active_tab );
             $(".starthidden").show();
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 8bb8a076e2..092cac1ab9 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
@@ -63,7 +63,7 @@
                                                     <th>On loan</th>
                                                     <th>Home library</th>
                                                     <th>Call number</th>
-                                                    <th>Actions</th>
+                                                    <th class="NoSort">Actions</th>
                                                 </tr>
                                             </thead>
                                             <tbody>
@@ -122,9 +122,6 @@
         $(document).ready(function() {
             [% FOREACH library IN libraries %]
                 $("#transferst[% library.branchcode | html %]").kohaTable({
-                    columnDefs: [
-                        { targets: [-1], orderable: false, searchable: false },
-                    ],
                     dom: "t",
                     paginate: false,
                 });
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 ed2cd1b0b9..7c1e32e408 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt
@@ -59,7 +59,7 @@
                 <th>On hold for</th>
                 <th>Home library</th>
                 <th>Call number</th>
-                <th>&nbsp;</th>
+                <th class="NoSort">&nbsp;</th>
             </tr></thead>
             <tbody>[% FOREACH reser IN branchesloo.reserv %]
                 [% IF ( reser.messcompa ) %]
@@ -126,9 +126,6 @@
         $(document).ready(function() {
             [% FOREACH branchesloo IN branchesloop %]
                 $("#transferst[% branchesloo.branchcode | html %]").kohaTable({
-                    columnDefs: [
-                        { targets: [-1], orderable: false, searchable: false },
-                    ],
                     dom: "t",
                     paginate: false,
                 });
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 3180ead8ed..4752d24618 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt
@@ -77,7 +77,7 @@
                                     <th>Public enrollment</th>
                                     <th>Email required</th>
                                     <th>Library</th>
-                                    <th class="noExport">Actions</th>
+                                    <th class="noExport NoSort">Actions</th>
                                 </tr>
                             </thead>
                             <tbody>
@@ -169,13 +169,11 @@
             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){
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 153ba541e8..8bcbde0a10 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
@@ -78,7 +78,7 @@
                                                         [% CASE 'Template ID'     %]<th>Template ID</th>
                                                         [% CASE 'Template Name'   %]<th>Template name</th>
                                                         [% CASE 'Description'     %]<th>Description</th>
-                                                        [% CASE 'Actions'         %]<th class="noExport">Actions</th>
+                                                        [% CASE 'Actions'         %]<th class="noExport NoSort">Actions</th>
                                                         [% CASE 'Profile ID'      %]<th>Profile ID</th>
                                                         [% CASE 'Printer Name'    %]<th>Printer name</th>
                                                         [% CASE 'Paper Bin'       %]<th>Paper bin</th>
@@ -197,7 +197,6 @@
             $("#labels-table").kohaTable({
                 pagingType: "full",
                 order: [[1, "asc"]],
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
             });
         });
     </script>
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 5de902207c..b39ab848bf 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt
@@ -43,7 +43,7 @@
               <th>Patron</th>
               <th>Library</th>
               <th>Date requested</th>
-              <th>Allow</th>
+              <th class="NoSort">Allow</th>
             </tr>
           </thead>
           <tbody>
@@ -80,9 +80,6 @@
                 info: true,
                 searching: true,
                 order: [[2, "asc"]],
-                columnDefs: [
-                    { targets: -1, orderable: false }
-                ],
             });
         });
     </script>
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 afc9c755e9..8b6a5f6b90 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
@@ -25,7 +25,7 @@
                 <table id="catst">
                     <thead>
                         <tr>
-                        <th>&nbsp;</th>
+                        <th class="NoSort">&nbsp;</th>
                         <th>Code</th>
                         <th>Description</th>
                         </tr>
@@ -68,7 +68,6 @@
             $("#catst").kohaTable({
                 dom: "t",
                 order: [[2, "asc"]],
-                columnDefs: [{ targets: [0], orderable: false, searchable: false }],
                 paginate: false,
             });
             $("#updatechildf").validate({
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 798bdf35cd..0082b14d1b 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
@@ -112,9 +112,9 @@
                                                                 [% CASE "Borrower Number" %]
                                                                     <th>Borrower number</th>
                                                                 [% CASE "Actions " %]
-                                                                    <th class="noExport">Actions</th>
+                                                                    <th class="noExport NoSort">Actions</th>
                                                                 [% CASE "Select" -%]
-                                                                    <th>Select</th>
+                                                                    <th class="NoSort">Select</th>
                                                                 [% CASE %]
                                                                     <th>[% header_field.field_label | html %]</th>
                                                             [% END -%]
@@ -312,7 +312,6 @@
                 $("#description").hide();
             [% END %]
             $("#batcht").kohaTable({
-                columnDefs: [{ targets: [-2, -1], orderable: false, searchable: false }],
                 order: [[0, "asc"]],
                 pagingType: "full",
                 lengthMenu: [aLengthMenu, aLengthMenuLabel],
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 d8e19ba8d9..7fdc08256a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt
@@ -130,7 +130,7 @@
                             <table id="claimst">
                                 <thead>
                                     <tr>
-                                        <th><input type="checkbox" id="CheckAll"></th>
+                                        <th class="NoSort"><input type="checkbox" id="CheckAll"></th>
                                         <th>Vendor</th>
                                         <th>Library</th>
                                         <th class="anti-the">Title</th>
@@ -248,9 +248,6 @@
         $(document).ready(function() {
             sTable = $("#claimst").kohaTable({
                 dom: "t",
-                columnDefs: [
-                    { targets: [0], orderable: false, searchable: false },
-                ],
                 paginate: false,
             });
             $('#supplierid').change(function() {
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 1af5b4eb7c..3e6bfe0220 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
@@ -215,7 +215,7 @@
                                             <thead>
                                                 <tr>
                                                     [% IF ( CAN_user_serials_receive_serials ) %]
-                                                        <th>Edit</th>
+                                                        <th class="NoSort">Edit</th>
                                                     [% END %]
                                                     [% IF ( subscriptions.size > 1 ) %]
                                                         <th># Subs</th>
@@ -228,7 +228,7 @@
                                                     <th>Notes</th>
                                                     <th>Library</th>
                                                     [% IF ( routing ) %]
-                                                        <th>Routing</th>
+                                                        <th class="NoSort">Routing</th>
                                                     [% END %]
                                                 </tr>
                                             </thead>
@@ -367,7 +367,6 @@
                 $("#subscription_years a:first").tab("show");
             }
             $(".subscription-year-table").kohaTable({
-                columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
                 order: [[0, "desc"]],
                 dom: "t",
                 autoWidth: false,
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 3997062247..0d1de011c0 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
@@ -300,7 +300,7 @@
                 <th>Description</th>
                 <th>Numbering formula</th>
                 <th>Display order</th>
-                <th class="noExport">Actions</th>
+                <th class="noExport NoSort">Actions</th>
               </tr>
             </thead>
             <tbody>
@@ -406,7 +406,6 @@
         $(document).ready(function(){
 
             $("#numberpatternst").kohaTable({
-                columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
                 pagingType: "full",
             });
 
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 f151a4ef58..719c5fc8b3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/list.tt
@@ -49,8 +49,8 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
         <table id="itemst">
             <thead><tr>
                 <th>Title</th>
-                <th>Location</th>
-                <th>&nbsp;</th>
+                <th class="NoSort">Location</th>
+                <th class="NoSort">&nbsp;</th>
                 </tr></thead>
 
                 [% FOREACH title IN titles %]
@@ -130,7 +130,6 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
                     }
             });
             $("#itemst").kohaTable({
-                columnDefs: [{ targets: [-1, -2], orderable: false, searchable: false }],
                 order: [[0, "asc"]],
                 pagingType: "full",
             });
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 974760f3a1..8a700dfa12 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
@@ -171,7 +171,7 @@
           <table id="biblios" class="records">
             <thead>
               <tr>
-                <th></th>
+                <th class="NoSort"></th>
                 <th>Biblionumber</th>
                 <th>Title</th>
                 <th>Items</th>
@@ -206,7 +206,7 @@
           <table id="authorities" class="records">
             <thead>
               <tr>
-                <th></th>
+                <th class="NoSort"></th>
                 <th>AuthID</th>
                 <th>Summary</th>
                 <th>Used in</th>
@@ -346,7 +346,6 @@
 
           $("#biblios").kohaTable({
               columnDefs: [
-                  { targets: [0], orderable: false, searchable: false },
                   { targets: [3, 4], type: "num-html" },
               ],
               dom: "t",
@@ -356,7 +355,6 @@
 
           $("#authorities").kohaTable({
               columnDefs: [
-                  { targets: [0], orderable: false, searchable: false },
                   { targets: [3], type: "num-html" },
               ],
               dom: "t",
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 e25f26ea7a..06c624b9b4 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
@@ -207,10 +207,10 @@
                                         <table id="biblios" class="records">
                                             <thead>
                                                 <tr>
-                                                    <th>&nbsp;</th>
+                                                    <th class="NoSort">&nbsp;</th>
                                                     <th>Biblionumber</th>
                                                     <th>Title</th>
-                                                    <th>&nbsp;</th>
+                                                    <th class="NoSort">&nbsp;</th>
                                                 </tr>
                                             </thead>
                                             <tbody>
@@ -237,10 +237,10 @@
                                         <table id="authorities" class="records">
                                             <thead>
                                                 <tr>
-                                                    <th></th>
+                                                    <th class="NoSort">&nbsp;</th>
                                                     <th>AuthID</th>
                                                     <th>Summary</th>
-                                                    <th>&nbsp;</th>
+                                                    <th class="NoSort">&nbsp;</th>
                                                 </tr>
                                             </thead>
                                             <tbody>
@@ -340,7 +340,6 @@
 
             $("#biblios").kohaTable({
                 columnDefs: [
-                    { targets: [0, 3], orderable: false, searchable: false },
                     { targets: [1], type: "num-html" },
                 ],
                 dom: "t",
@@ -350,7 +349,6 @@
 
             $("#authorities").kohaTable({
                 columnDefs: [
-                    { targets: [0, 3], orderable: false, searchable: false },
                     { targets: [1], type: "num-html" },
                 ],
                 dom: "t",
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
index 106f8c0644..b328c60045 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt
@@ -288,11 +288,11 @@
                                     <caption class="sr-only">Items in your cart</caption>
                                     <thead>
                                         <tr>
-                                            <th class="noprint">&nbsp;</th>
+                                            <th class="noprint NoSort">&nbsp;</th>
                                             <th>Title</th>
                                             <th>Author</th>
                                             <th>Year</th>
-                                            <th>Location (Status)</th>
+                                            <th class="NoSort">Location (Status)</th>
                                         </tr>
                                     </thead>
                                     <tbody>
@@ -500,7 +500,6 @@
                 if( $("#itemst").length > 0 ){
                     var itemst = $("#itemst").kohaTable({
                         order: [[1, "asc"]],
-                        columnDefs: [{ targets: [0, -1], orderable: false, searchable: false }],
                     });
 
                     var buttons = new $.fn.dataTable.Buttons(itemst, {
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt
index 157875d0b3..104b617262 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-idref.tt
@@ -29,8 +29,8 @@
               <thead>
                 <tr>
                   <th>Citation</th>
-                  <th>Koha</th>
-                  <th>Sudoc</th>
+                  <th class="NoSort">Koha</th>
+                  <th class="NoSort">Sudoc</th>
                 </tr>
               </thead>
               <tbody>
@@ -54,7 +54,6 @@
   $(document).ready(function (){
         $("table").kohaTable({
             filter: false,
-            columnDefs: [{ targets: [-1, -2], orderable: false }],
         });
 
       $(".role").click(function(){
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
index cc7fde5525..457d2ef230 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
@@ -148,7 +148,7 @@
                                         <th>Status</th>
                                         <th>Request placed</th>
                                         <th>Last updated</th>
-                                        <th></th>
+                                        <th class="NoSort"></th>
                                     </tr>
                                 </thead>
                                 <tbody>
@@ -341,7 +341,6 @@
     [% INCLUDE 'datatables.inc' %]
     <script>
         $("#illrequestlist").kohaTable({
-            columnDefs: [{ targets: [-1], orderable: false, searchable: false }],
             order: [[3, "desc"]],
         });
         $("#backend-dropdown-options").removeClass("nojs");
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
index 258f8599ab..c543859cc1 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
@@ -243,7 +243,6 @@
                 columnDefs: [
                     { className: "dtr-control", orderable: false, targets: [-1] },
                     { visible: false, targets: [0] },
-                    { orderable: false, targets: [1] },
                 ],
             },
         );
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt
index d7021516e3..4774191778 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt
@@ -91,7 +91,7 @@
                     <caption class="sr-only">Current session</caption>
                     <thead>
                         <tr>
-                            <th></th>
+                            <th class="NoSort"></th>
                             <th>Date</th>
                             <th>Search</th>
                             <th>Results</th>
@@ -297,7 +297,6 @@
             order: [[1, "desc"]],
             dom: '<"top"<"table_entries"><"table_controls"fB>>t',
             columnDefs: [
-                { targets: [0], orderable: false, searchable: false },
                 { className: "dtr-control", orderable: false, targets: -1 },
             ],
             language: {
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
index c746ba9764..b78972f7db 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt
@@ -147,7 +147,7 @@
                                     <caption>Your tags</caption>
                                     <thead>
                                         <tr>
-                                            <th>&nbsp;</th>
+                                            <th class="NoSort">&nbsp;</th>
                                             <th>Term</th>
                                             <th class="all anti-the">Title</th>
                                             <th>Date added</th>
@@ -262,7 +262,6 @@
         $("#mytagst").kohaTable({
             sorting: [[2, "asc"]],
             columnDefs: [
-                { targets: [0], orderable: false, searchable: false },
                 { className: "dtr-control", orderable: false, targets: -1 },
                 { responsivePriority: 1, targets: 2 },
             ],
-- 
2.39.5