Bug 41314 - Column visibility broken on the checkouts table
Summary: Column visibility broken on the checkouts table
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Baptiste Wojtkowski (bwoj)
URL:
Keywords:
Depends on: 33484
Blocks:
  Show dependency treegraph
 
Reported: 2025-11-26 14:49 UTC by Baptiste Wojtkowski (bwoj)
Modified: 2025-11-27 14:01 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the display of the 'Export' column on a patron's check out and details sections when ExportCircHistory is enabled and disabled. Because of a regression (caused by DT's saveState, bug 33484), the column was not correctly shown unless you cleared the cache/local storage: - If ExportCircHistory was set to 'Show', it is shown the first time. - If ExportCircHistory is then set to 'Don't show', the export column continues to show until you clear the browser cache/local storage.
Version(s) released in:
Circulation function:


Attachments
Bug 41314: Fix column visibility on the checkouts table (8.85 KB, patch)
2025-11-27 10:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41314: Fix column visibility on the checkouts table (8.89 KB, patch)
2025-11-27 10:36 UTC, David Nind
Details | Diff | Splinter Review
Bug 41314: Fix column visibility on the checkouts table (8.97 KB, patch)
2025-11-27 14:01 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Wojtkowski (bwoj) 2025-11-26 14:49:48 UTC
I came up to this question while studying following bug:

1 - Set  ExportCircHistory to "Don't show"
2 - Check out a book to Henry Acevedo
3 - Look at their circulation history : the footer is broken (it does not fit the lenght of the array), and you cannot export anymore.

This bug is still valid and is due to this lines from checkouts-table-footer.inc:
  7         [% IF Koha.Preference('ExportCircHistory') %]
  8             [% SET td_colspan = 4 %]
  9         [% ELSE %]
 10             [% SET td_colspan = 3 %]
 11         [% END %]

However, as far as I understand the syspref the column concerned is always displayed and there is no change in the amount of displayed columns, colspan 3 does not fit. Hence I have two questions :
1 - Has it really been the purpose of this system preference to manage the column named "Export" (I did not explore the history of the code, I'll dig if no one knows)
2 - Shouldn't we simply delete this system preference and have it managed by the columns manager ?
Comment 1 David Nind 2025-11-26 17:27:34 UTC
Some observations:

1. ExportCircHistory is incorrectly named: see Bug 40623 - ExportCircHistory preference is 
   misnamed (and Bug 33828 - ExportCircHistory description is misleading, pushed in 23.11).

   If enabled, you get the export column and this text under the check outs table:

     "Export checkouts using format: [MARC with items|MARC without items] Export items 
      bundle contents [] Don't export fields: _________ "Export"

2. A related system preference is ExportRemoveFields. If you add a value to this, 
   such as 100a, then it is shown in "Don't export fields". However, if you do this, then 
   the export column is not shown! (Even if you clear the browser cache).

3. There is also a problem at the moment when you turn off ExportCircHistory:
   - If you change it to "Don't show", the "Export" column is still shown, 
     and only clearing the browser cache (or maybe just local storage?) 
     removes the column.
   - If you don't clear the cache, the standard data tables export option 
     "doesn't work" - there is a spinner when you select any of the export 
     options, nothing is exported, and the spinner stays there (this looks the 
     same as Bug 39389 - Cannot use dataTables export function on checkout table 
     in members/moremember.pl, pushed to 25.05 - maybe it is back?)

So, to answer your question (I think):

1. The export column on the patron check out table is not related to the standard DataTables export option.

2. There is a problem turning off ExportCircHistory - the export column is still shown unless you clear your cache.

3. ExportCircHistory is misnamed, it allows you to export current checkouts in MARC format, with and without items.

4. There is also a problem if you use the related system preference ExportRemoveFields. If you add a value to this, such as 100a, then it is shown in "Don't export fields" when ExportCircHistory is enabled. However, if you do this, then the export column is not shown! (Even if you clear the browser cache).
Comment 2 Jonathan Druart 2025-11-27 10:09:19 UTC
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.
Comment 3 Jonathan Druart 2025-11-27 10:15:53 UTC
Created attachment 189986 [details] [review]
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)
Comment 4 David Nind 2025-11-27 10:36:14 UTC
Created attachment 189987 [details] [review]
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)

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 Baptiste Wojtkowski (bwoj) 2025-11-27 14:01:13 UTC
Created attachment 189992 [details] [review]
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)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>