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: Signed Off --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: david, gmcharlt
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:
Circulation function:
Bug Depends on:    
Bug Blocks: 40168    
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

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.