Bug 39739

Summary: OPAC's datatables.js out of sync with staff's
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: TemplatesAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Pushed to main --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, martin.renvoize, oleonard, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 39600    
Attachments: Bug 39739: Sync OPAC's datatables.js with the staff interface's version
Bug 39739: Sync OPAC's datatables.js with the staff interface's version

Description Tomás Cohen Arazi (tcohen) 2025-04-24 12:56:27 UTC
When helping adapt bug 38340 to our coding guidelines and general style, I found the need to rewrite a manually crafted datatable using kohaTable. What I found is that key pieces (like x-koha-request-id handling) are missing.

I propose we port the intranet version into the OPAC. With some caveats.
Comment 1 Tomás Cohen Arazi (tcohen) 2025-04-24 13:22:26 UTC
Created attachment 181444 [details] [review]
Bug 39739: Sync OPAC's datatables.js with the staff interface's version

This patch overwrites the OPAC version of `datatables,js` with the one
for the staff interface.

A block code adding links to the columns configuration page is removed
as it doesn't apply to the OPAC and produces errors in the console for
missing variable definitions that would be inherited from the caller
context (looking for `CAN_user_parameters_manage_column_config`).

To test:
1. Apply this patch
2. Find templates using `kohaTable`:
   $ cd koha-tmpl/opac-tmpl
   $ git grep kohaTable
3. Play in the UI with those pages
=> SUCCESS: Tables work, nothing's broken
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Martin Renvoize (ashimema) 2025-04-25 11:34:20 UTC
Created attachment 181506 [details] [review]
Bug 39739: Sync OPAC's datatables.js with the staff interface's version

This patch overwrites the OPAC version of `datatables,js` with the one
for the staff interface.

A block code adding links to the columns configuration page is removed
as it doesn't apply to the OPAC and produces errors in the console for
missing variable definitions that would be inherited from the caller
context (looking for `CAN_user_parameters_manage_column_config`).

To test:
1. Apply this patch
2. Find templates using `kohaTable`:
   $ cd koha-tmpl/opac-tmpl
   $ git grep kohaTable
3. Play in the UI with those pages
=> SUCCESS: Tables work, nothing's broken
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 3 Martin Renvoize (ashimema) 2025-04-25 11:35:46 UTC
Simple resync.. agree with the singular removed function that's a staff only requirement and I've tested various tables in the OPAC.

Happy it's all working.. QA script reports some new console.logs but I don't think there's anything to worry about here.

Passing QA

(I do think there's some tidying up we can do down the line to both the staff and opac versions of this.. feels like we're duplicating some code when I looked)
Comment 4 Katrin Fischer 2025-04-25 16:36:30 UTC
Pushed for 25.05!

Well done everyone, thank you!