From 441605646ca0fc1934a57dea8b84715425865fb2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 27 Nov 2025 11:03:45 +0100 Subject: [PATCH] Bug 41314: Fix column visibility on the checkouts table Currently the column visibility is broken because the table is not using bKohaColumnsUseNames. We should first fix that because it's a bug (and a regression certainly caused by DT's saveState, bug 33484). Then it will be quite trivial to move it to the table's settings. Column visibility must use bKohaColumnsUseNames when some columns are displayed/hidden depending on sysprefs (or other variables). Test plan: 0. Do not apply this patch 1. Check an item out for a patron 2. Turn on ExportCircHistory 3. Reload the checkouts table => The export column is not displayed (FAIL) 4. Open the dev console (ctrl+shift+c on Firefox), Storage tab => local storage. Remove the 2 keys (only one may exist) DataTables_circ_circulation_issues-table DataTables_members_moremember_issues-table 5. Reload the checkouts table => The export column is displayed 6. Turn off ExportCircHistory 7. Reload the checkouts table => The column column is displayed (FAIL) Well, you got the idea, the syspref's value is not taken into account when a DataTable's state already exists in the local storage. Now apply this patch and repeat the different steps, on the two tabs * "Check out" (circ/circulation.pl) * "Default" (members/moremember.pl) --- .../en/includes/checkouts-table-footer.inc | 7 +-- .../prog/en/includes/checkouts-table.inc | 44 +++++++++---------- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 44 ++++++++++++++----- 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc index 498469ddc86..d6259aa8b6c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc @@ -4,12 +4,7 @@ - [% IF Koha.Preference('ExportCircHistory') %] - [% SET td_colspan = 4 %] - [% ELSE %] - [% SET td_colspan = 3 %] - [% END %] - +

select all | none

- Check in

select all | none

- Return claims - Return claims + Export

select all | none

diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 8f73b328d8d..5770d17ec7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -36,24 +36,43 @@ function LoadIssuesTable() { $("#issues-table").show(); $("#issues-table-actions").show(); var msg_loading = __("Loading... you may continue scanning."); + let renew_column = table_settings_issues_table.columns.find( + c => c.columnname == "renew" + ); + let checkin_column = table_settings_issues_table.columns.find( + c => c.columnname == "checkin" + ); + if (!AllowCirculate) { - table_settings_issues_table.columns.find( - c => c.columnname == "renew" - ).is_hidden = 42; - table_settings_issues_table.columns.find( - c => c.columnname == "checkin" - ).is_hidden = 1; + renew_column.is_hidden = 1; + renew_column.force_visibility = 1; + } else { + renew_column.is_hidden = 0; + checkin_column.is_hidden = 0; } + renew_column.force_visibility = 1; + checkin_column.force_visibility = 1; + + let claims_returned_column = table_settings_issues_table.columns.find( + c => c.columnname == "claims_returned" + ); if (!ClaimReturnedLostValue) { - table_settings_issues_table.columns.find( - c => c.columnname == "claims_returned" - ).is_hidden = 1; + claims_returned_column.is_hidden = 1; + } else { + claims_returned_column.is_hidden = 0; } + claims_returned_column.force_visibility = 1; + + let export_column = table_settings_issues_table.columns.find( + c => c.columnname == "export" + ); if (!exports_enabled) { - table_settings_issues_table.columns.find( - c => c.columnname == "export" - ).is_hidden = 1; + export_column.is_hidden = 1; + } else { + export_column.is_hidden = 0; } + export_column.force_visibility = 1; + issuesTable = $("#issues-table").kohaTable( { language: { @@ -665,6 +684,7 @@ function LoadIssuesTable() { ), }, bKohaAjaxSVC: true, + bKohaColumnsUseNames: true, rowGroup: { dataSrc: "issued_today", startRender: function (rows, group) { -- 2.43.0