Bug 39389

Summary: Cannot use dataTables export function on checkout table in members/moremember.pl
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CirculationAssignee: Nick Clemens (kidclamp) <nick>
Status: Pushed to stable --- QA Contact: Lucas Gass (lukeg) <lucas>
Severity: normal    
Priority: P5 - low CC: aude.charillon, chughesman, dcook, fridolin.somers, gmcharlt, januszop, karie.straube, kkrueger, kyle, Laura.escamilla, lisette, nick, rcoert
Version: MainKeywords: rel_24_11_candidate
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40147
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00,24.11.10
Circulation function:
Attachments: Bug 39389: Don't stringify the system preference value
Bug 39389: Don't stringify the system preference value
Bug 39389: Don't stringify the system preference value
Bug 39389: Don't stringify the system preference value

Description Lucas Gass (lukeg) 2025-03-19 20:44:31 UTC
To recreate:

1. Find a patron with some checkouts
2. Go to members/moremember.pl?borrowernumber=X where x is the borrowernumber
3. Load the checkout table 
4. Click 'Export' and choose any option. 


Uncaught TypeError: t.aoFooter[(intermediate value)][e] is undefined
Comment 1 Carolyn Hughesman 2025-03-21 17:47:15 UTC
We are experiencing this bug too.
Comment 2 Nick Clemens (kidclamp) 2025-04-02 14:21:14 UTC Comment hidden (obsolete)
Comment 3 Magnus Enger 2025-04-03 14:17:25 UTC
Created attachment 180570 [details] [review]
Bug 39389: Don't stringify the system preference value

This bug is caused by the code that is intended to hide the export column when disabled failing
because the value of exports_enabled is "0" and not 0

To test:
1 - Checkout an item to a patron
2 - Disable ExportCircHistory
3 - Load the patron's circulation table on the Check Out tab
4 - Notice no export column
5 - Click 'Export' above the table and you can export
6 - Go to the patron's circulation table on the Details tab
7 - The export column shows
8 - Try to export - JS error
9 - Apply patch
10 - Clear local storage in the browser
11 - Repeat 3-6 - no more export column and you can export
12 - Enable ExportCircHistory
13 - Confirm the circ table on both pages hsows the export column and can be exported
     (You may need to clear local storage again)

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Comment 4 Biblibre Sandboxes 2025-04-04 11:31:21 UTC
Created attachment 180626 [details] [review]
Bug 39389: Don't stringify the system preference value

This bug is caused by the code that is intended to hide the export column when disabled failing
because the value of exports_enabled is "0" and not 0

To test:
1 - Checkout an item to a patron
2 - Disable ExportCircHistory
3 - Load the patron's circulation table on the Check Out tab
4 - Notice no export column
5 - Click 'Export' above the table and you can export
6 - Go to the patron's circulation table on the Details tab
7 - The export column shows
8 - Try to export - JS error
9 - Apply patch
10 - Clear local storage in the browser
11 - Repeat 3-6 - no more export column and you can export
12 - Enable ExportCircHistory
13 - Confirm the circ table on both pages hsows the export column and can be exported
     (You may need to clear local storage again)

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Janne <janne.seppanen@lahti.fi>
Comment 5 Lucas Gass (lukeg) 2025-05-02 17:04:00 UTC
Trivial fix that makes perfect sense, QAing here.
Comment 6 Lucas Gass (lukeg) 2025-05-02 17:04:41 UTC
Created attachment 181878 [details] [review]
Bug 39389: Don't stringify the system preference value

This bug is caused by the code that is intended to hide the export column when disabled failing
because the value of exports_enabled is "0" and not 0

To test:
1 - Checkout an item to a patron
2 - Disable ExportCircHistory
3 - Load the patron's circulation table on the Check Out tab
4 - Notice no export column
5 - Click 'Export' above the table and you can export
6 - Go to the patron's circulation table on the Details tab
7 - The export column shows
8 - Try to export - JS error
9 - Apply patch
10 - Clear local storage in the browser
11 - Repeat 3-6 - no more export column and you can export
12 - Enable ExportCircHistory
13 - Confirm the circ table on both pages hsows the export column and can be exported
     (You may need to clear local storage again)

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Janne <janne.seppanen@lahti.fi>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 7 David Cook 2025-05-05 00:50:51 UTC
Yep looks good at a glance. Generally I don't like to see quotes disappear from Javascript, but this is a sensible change which doesn't introduce any security issues.
Comment 8 Katrin Fischer 2025-05-06 16:53:57 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 9 Kristi Krueger 2025-06-10 15:23:12 UTC
Could this be considered for backport?
Comment 10 Katrin Fischer 2025-06-16 10:08:35 UTC
I also have an error on this page, but it's:
Uncaught TypeError: document.referrer.split(...)[1] is undefined

Could bug 40147 be a similar issue?
Comment 11 Aude Charillon 2025-08-01 09:35:40 UTC
This is also an issue in 24.11 (tested on 24.11.07) and it would be good for the fix to be backported.
Comment 12 Janusz Kaczmarek 2025-08-29 21:05:29 UTC
*** Bug 40733 has been marked as a duplicate of this bug. ***
Comment 13 Janusz Kaczmarek 2025-08-30 11:09:24 UTC
Please port it to 24.11 -- see Bug 40733.
Comment 14 Fridolin Somers 2025-10-08 08:02:15 UTC
Pushed to 24.11.x for 24.11.10
Comment 15 Fridolin Somers 2025-10-08 08:12:59 UTC
There may be other cases

I've run some grep :

git grep -E '= ?"\[% Koha.Preference' -- koha-tmpl/ | awk -F '(\(|\))' '{print $2}' | sort -u > sysprefs.txt

Then filter on boolean prefs :
 > for i in $(cat sysprefs.txt) ; do grep $i installer/data/mysql/mandatory/sysprefs.sql | grep YesNo ; done
('ExtendedPatronAttributes','1',NULL,'Use extended patron IDs and attributes','YesNo'),
('OPACPlayMusicalInscripts','0','','If displayed musical inscripts, play midi conversion on the OPAC record details page.','YesNo'),
('OPACPopupAuthorsSearch','0','','Display the list of authors when clicking on one author.','YesNo'),
('StaffHighlightedWords','1','','Highlight search terms on staff interface','YesNo'),
('UnseenRenewals','0','','Allow renewals to be recorded as "unseen" by the library, and count against the patrons unseen renewals limit.','YesNo'),

We may have a closer look