Bug 40127 - JS error on biblio detail page when there are no items
Summary: JS error on biblio detail page when there are no items
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords: rel_24_11_candidate, rel_25_05_candidate, rel_25_11_candidate
Depends on:
Blocks: 40168
  Show dependency treegraph
 
Reported: 2025-06-12 07:59 UTC by Jonathan Druart
Modified: 2025-06-18 20:38 UTC (History)
2 users (show)

See Also:
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:


Attachments
Bug 40127: Move build_items_table outside of document.ready (5.94 KB, patch)
2025-06-12 08:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Add a Cypress test (5.67 KB, patch)
2025-06-12 08:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Remove JS error from the biblio detail page when no items (1.54 KB, patch)
2025-06-12 08:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Move build_items_table outside of document.ready (5.94 KB, patch)
2025-06-12 08:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Add a Cypress test (5.67 KB, patch)
2025-06-12 08:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Remove JS error from the biblio detail page when no items (1.54 KB, patch)
2025-06-12 08:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40127: Move build_items_table outside of document.ready (5.99 KB, patch)
2025-06-13 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 40127: Add a Cypress test (5.72 KB, patch)
2025-06-13 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 40127: Remove JS error from the biblio detail page when no items (1.58 KB, patch)
2025-06-13 08:31 UTC, David Nind
Details | Diff | Splinter Review
Bug 40127: Add a Cypress test (5.72 KB, patch)
2025-06-16 13:32 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.