From 41341b25f6813c4de6d91d17b98916d8e0602a95 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Dec 2024 11:48:42 +0100 Subject: [PATCH] Bug 38595: Fix broken table settings behaviour on some tables at the OPAC Problem highlighted by bug 38436. There is a JS error on some views with tables at the OPAC. Uncaught TypeError: table_settings.columns is undefined Test plan: Go to the 3 views modified by this patch and confirm that the JS error in the console is gone when this patch is applied. --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt | 3 +-- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt | 3 +-- .../opac-tmpl/bootstrap/en/modules/opac-search-history.tt | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt index 3e39a2725b5..cca64a62748 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt @@ -185,7 +185,6 @@ $('#sort').change(function() { $('#sortform').submit(); }); - var columns_settings = []; // Empty because there are no columns we want to be configurable var table = KohaTable("#table_holdshistory", { "dom": '<"top"<"table_entries"i><"table_controls"fB>>t', "autoWidth": false, @@ -197,7 +196,7 @@ "search": "_INPUT_", "searchPlaceholder": _("Search") } - }, columns_settings); + }); }); [% END %] 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 c0a3b0212c6..497ee3fbaa1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -234,7 +234,6 @@ $('#sortform').submit(); }); - var columns_settings = []; // Empty because there are no columns we want to be configurable var table = KohaTable("#readingrec", { "dom": '<"top"<"table_entries"i><"table_controls"fB>>t', "language": { @@ -249,7 +248,7 @@ { "visible": false, "targets": [0]}, { "orderable": false, "targets": [1]} ], - }, columns_settings); + }); let table_dt = table.DataTable(); $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { 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 196471ce728..1d35a87e8f9 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 @@ -294,7 +294,6 @@ $(document).ready(function() { // We show table ordered by descending dates by default // (so that the more recent query is shown first) - var columns_settings = []; // Empty because there are no columns we want to be configurable var table = KohaTable(".historyt", { "order": [[ 1, "desc" ]], "dom": '<"top"<"table_entries"><"table_controls"fB>>t', @@ -309,7 +308,7 @@ "responsive": { "details": { "type": 'column',"target": -1 } }, - }, columns_settings); + }); $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { table.DataTable().responsive.recalc(); -- 2.34.1