Bug 40544

Summary: Manage bundle button broken
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: CatalogingAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: david, jonathan.druart, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Bug Depends on: 40127    
Bug Blocks:    
Attachments: Bug 40544: Move some bundles related code out of document.ready
Bug 40544: Move some bundles related code out of document.ready
Bug 40544: Move some bundles related code out of document.ready
Bug 40544: Move some bundles related code out of document.ready

Description Caroline Cyr La Rose 2025-07-29 17:04:45 UTC
The "Manage bundle" button doesn't work on my KTD. When I click it, it doesn't do anything and there are errors in the console.

To recreate :
1. Find a record with items
2. Click Edit > Edit record
3. Change the 7th position of the leader to "c"
   OR 
   - Click the Tag editor for the leader
   - Choose "c-Collection" under "7- Bibliographic level"
   - Click "Save"
   (If necessary, fill out any other missing mandatory fields, like 040$c)
4. Click "Save"
5. Click "Manage bundles (0|0)" next to one of the items
   --> Nothing happens
   --> Error in the console "Uncaught ReferenceError: createChild is not defined"
   --> Normal behaviour : it should open a tab (?) to add records to the bundle

A bisect pointed to bug 40127 as the possible source of the error...
Comment 1 Caroline Cyr La Rose 2025-07-29 17:05:38 UTC
I put the level at major because the is a functionality that is broken.
Comment 2 David Nind 2025-07-29 19:16:30 UTC
Can confirm that this is happening in main and 25.05.x.
Comment 3 Caroline Cyr La Rose 2025-07-29 19:32:43 UTC
(In reply to David Nind from comment #2)
> Can confirm that this is happening in main and 25.05.x.

Thanks for confirming David! It felt impossible that this has been going on for a month and there wasn't any bug report about it... I was sure I was doing something wrong.
Comment 4 David Nind 2025-07-29 20:09:47 UTC
Can also confirm that it doesn't work in 24.11.x (tested in 24.11.07).

The button works in a 24.05.x site.
Comment 5 Caroline Cyr La Rose 2025-07-29 20:30:59 UTC
(In reply to David Nind from comment #4)
> Can also confirm that it doesn't work in 24.11.x (tested in 24.11.07).
> 
> The button works in a 24.05.x site.

Ok so it means the link to bug 40127 isn't justified, as it was added to 24.11.08.
Comment 6 Caroline Cyr La Rose 2025-07-29 20:54:46 UTC
I was actually trying to test/document bug 29560 when I found this. The error might come from there, createChild from the error in the console seems like it could refer to that...
Comment 7 Jonathan Druart 2025-07-30 08:15:03 UTC
Created attachment 184858 [details] [review]
Bug 40544: Move some bundles related code out of document.ready

On bug 40127 we moved the build_items_table calls outside of document
ready, but createChild is defined in document.ready (and so defined too
late).

This patches fix the following JS error:
"Uncaught ReferenceError: createChild is not defined"
Comment 8 David Nind 2025-07-30 08:56:50 UTC
Created attachment 184860 [details] [review]
Bug 40544: Move some bundles related code out of document.ready

On bug 40127 we moved the build_items_table calls outside of document
ready, but createChild is defined in document.ready (and so defined too
late).

This patches fix the following JS error:
"Uncaught ReferenceError: createChild is not defined"

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 Caroline Cyr La Rose 2025-07-30 13:32:14 UTC
Created attachment 184891 [details] [review]
Bug 40544: Move some bundles related code out of document.ready

On bug 40127 we moved the build_items_table calls outside of document
ready, but createChild is defined in document.ready (and so defined too
late).

This patches fix the following JS error:
"Uncaught ReferenceError: createChild is not defined"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 10 Caroline Cyr La Rose 2025-07-30 13:33:13 UTC
Thank you Jonathan and David! It was already signed off, but I added mine as a thank you anyway :)
Comment 11 Marcel de Rooy 2025-08-01 07:44:15 UTC
Created attachment 184972 [details] [review]
Bug 40544: Move some bundles related code out of document.ready

On bug 40127 we moved the build_items_table calls outside of document
ready, but createChild is defined in document.ready (and so defined too
late).

This patches fix the following JS error:
"Uncaught ReferenceError: createChild is not defined"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Lucas Gass (lukeg) 2025-08-01 19:25:29 UTC
Nice work everyone!

Pushed to main for 25.11