Bug 40127

Summary: JS error on biblio detail page when there are no items
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Staff interfaceAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to oldstable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: david, fridolin.somers, gmcharlt, m.de.rooy
Version: MainKeywords: rel_24_11_candidate, rel_25_05_candidate, rel_25_11_candidate
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes a JavaScript error on bibliographic record pages in the staff interface, where the record has no items.
Version(s) released in:
25.11.00,25.05.02,24.11.08
Circulation function:
Bug Depends on:    
Bug Blocks: 40168, 40544    
Attachments: Bug 40127: Move build_items_table outside of document.ready
Bug 40127: Add a Cypress test
Bug 40127: Remove JS error from the biblio detail page when no items
Bug 40127: Move build_items_table outside of document.ready
Bug 40127: Add a Cypress test
Bug 40127: Remove JS error from the biblio detail page when no items
Bug 40127: Move build_items_table outside of document.ready
Bug 40127: Add a Cypress test
Bug 40127: Remove JS error from the biblio detail page when no items
Bug 40127: Add a Cypress test
Bug 40127: Move build_items_table outside of document.ready
Bug 40127: Remove JS error from the biblio detail page when no items
Bug 40127: Add a Cypress test

Description Jonathan Druart 2025-06-12 07:59:01 UTC
"build_items_table is not defined"
Comment 1 Jonathan Druart 2025-06-12 08:07:22 UTC
Created attachment 183185 [details] [review]
Bug 40127: Move build_items_table outside of document.ready

So it's not delayed and we catch have the error in the Cypress test.
Otherwise the error appear too late (in the after each) and the test
does not fail
Comment 2 Jonathan Druart 2025-06-12 08:07:24 UTC
Created attachment 183186 [details] [review]
Bug 40127: Add a Cypress test
Comment 3 Jonathan Druart 2025-06-12 08:07:26 UTC
Created attachment 183187 [details] [review]
Bug 40127: Remove JS error from the biblio detail page when no items

"build_items_table is not defined"

We should not try to build the items table if there are no items.

Test plan:
Go to the bibliographic detail page of a biblio without items
You should not see errors in the browser's console

Go to the bibliographic detail page of a biblio with items
You should not see errors in the browser's console
The table should be displayed and the different features should work as
before
Comment 4 Jonathan Druart 2025-06-12 08:16:12 UTC
Created attachment 183188 [details] [review]
Bug 40127: Move build_items_table outside of document.ready

So it's not delayed and we catch have the error in the Cypress test.
Otherwise the error appear too late (in the after each) and the test
does not fail
Comment 5 Jonathan Druart 2025-06-12 08:16:14 UTC
Created attachment 183189 [details] [review]
Bug 40127: Add a Cypress test
Comment 6 Jonathan Druart 2025-06-12 08:16:17 UTC
Created attachment 183190 [details] [review]
Bug 40127: Remove JS error from the biblio detail page when no items

"build_items_table is not defined"

We should not try to build the items table if there are no items.

Test plan:
Go to the bibliographic detail page of a biblio without items
You should not see errors in the browser's console

Go to the bibliographic detail page of a biblio with items
You should not see errors in the browser's console
The table should be displayed and the different features should work as
before
Comment 7 David Nind 2025-06-13 08:31:51 UTC
Created attachment 183228 [details] [review]
Bug 40127: Move build_items_table outside of document.ready

So it's not delayed and we catch have the error in the Cypress test.
Otherwise the error appear too late (in the after each) and the test
does not fail

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2025-06-13 08:31:54 UTC
Created attachment 183229 [details] [review]
Bug 40127: Add a Cypress test

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-06-13 08:31:57 UTC
Created attachment 183230 [details] [review]
Bug 40127: Remove JS error from the biblio detail page when no items

"build_items_table is not defined"

We should not try to build the items table if there are no items.

Test plan:
Go to the bibliographic detail page of a biblio without items
You should not see errors in the browser's console

Go to the bibliographic detail page of a biblio with items
You should not see errors in the browser's console
The table should be displayed and the different features should work as
before

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 Jonathan Druart 2025-06-16 13:32:11 UTC
Created attachment 183283 [details] [review]
Bug 40127: Add a Cypress test

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 Jonathan Druart 2025-06-16 13:32:21 UTC
Removed ".only" from cypress test.
Comment 12 Marcel de Rooy 2025-06-24 12:50:09 UTC
Created attachment 183452 [details] [review]
Bug 40127: Move build_items_table outside of document.ready

So it's not delayed and we catch have the error in the Cypress test.
Otherwise the error appear too late (in the after each) and the test
does not fail

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2025-06-24 12:50:11 UTC
Created attachment 183453 [details] [review]
Bug 40127: Remove JS error from the biblio detail page when no items

"build_items_table is not defined"

We should not try to build the items table if there are no items.

Test plan:
Go to the bibliographic detail page of a biblio without items
You should not see errors in the browser's console

Go to the bibliographic detail page of a biblio with items
You should not see errors in the browser's console
The table should be displayed and the different features should work as
before

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 14 Marcel de Rooy 2025-06-24 12:50:13 UTC
Created attachment 183454 [details] [review]
Bug 40127: Add a Cypress test

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 15 Lucas Gass (lukeg) 2025-06-24 13:52:52 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 16 Paul Derscheid 2025-07-09 11:43:28 UTC
Nice work everyone!

Pushed to 25.05.x for 25.05.01
Comment 17 Fridolin Somers 2025-07-25 13:33:16 UTC
Pushed to 24.11.x for 24.11.08