[Bug 42611] New: Javascript error on readingrec.pl when no reading history
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Bug ID: 42611 Summary: Javascript error on readingrec.pl when no reading history Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com If you start a fresh KTD, open your F12 tools, and go to http://localhost:8081/cgi-bin/koha/members/readingrec.pl?borrowernumber=51 you'll see a Javascript error. It's because we call 'let table_dt = table.DataTable();' when when "table" is not defined. Should be an easy fix. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- Created attachment 199170 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199170&action=edit Bug 42611: Fix Javascript error when no Circulation history This patch checks that "table" is defined before trying to access the DataTable object for it. This patch also moves the Javascript from the .tt file into a separate .js file since it doesn't need any Template::Toolkit itself. Test plan: 0. Apply the patch (and reset_all) 1. Log into the staff interface 2. Go to http://localhost:8081/cgi-bin/koha/members/readingrec.pl?borrowernumber=51 3. Open the console and see there is no longer a Javascript error 4. Check out an item like 39999000001310 to this user 5. Review the "Circulation history" and note that the DataTable appears and there are no Javascript errors -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Hurray for the "JS1: Embedding JavaScript blocks in templates" coding guideline :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199170|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 199173 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199173&action=edit Bug 42611: Fix Javascript error when no Circulation history This patch checks that "table" is defined before trying to access the DataTable object for it. This patch also moves the Javascript from the .tt file into a separate .js file since it doesn't need any Template::Toolkit itself. Test plan: 0. Apply the patch (and reset_all) 1. Log into the staff interface 2. Go to http://localhost:8081/cgi-bin/koha/members/readingrec.pl?borrowernumber=51 3. Open the console and see there is no longer a Javascript error 4. Check out an item like 39999000001310 to this user 5. Review the "Circulation history" and note that the DataTable appears and there are no Javascript errors Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- I am not against moving to separate JS files, but I have advertise big work in the datatables and script tags area in the last months, and this is only causing more conflicts. We had this error in a couple of other places and we solved it with a single character: - let table_dt = table.DataTable(); + let table_dt = table?.DataTable(); Also it would have helped to have the fix separate than the move, to clearly identify what the fix is. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart@gmail.com |y.org | Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199173|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200748 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200748&action=edit Bug 42611: Fix Javascript error when no Circulation history This patch checks that "table" is defined before trying to access the DataTable object for it. This patch also moves the Javascript from the .tt file into a separate .js file since it doesn't need any Template::Toolkit itself. Test plan: 0. Apply the patch (and reset_all) 1. Log into the staff interface 2. Go to http://localhost:8081/cgi-bin/koha/members/readingrec.pl?borrowernumber=51 3. Open the console and see there is no longer a Javascript error 4. Check out an item like 39999000001310 to this user 5. Review the "Circulation history" and note that the DataTable appears and there are no Javascript errors Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200750 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200750&action=edit Bug 42611: Add missing raw filter [FAIL] koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt FAIL filters asset_must_be_raw at line 172 ( [% Asset.js("js/members/readingrec.js") %]) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #7 from Pedro Amorim (ammopt) <pedro.amorim@openfifth.co.uk> --- Thanks everyone! Pushed to main for 26.11! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bibliothek@th-wildau.de --- Comment #8 from Jan Kissig <bibliothek@th-wildau.de> --- The same error applies for opac-readingrecord.pl but I would fix that in 42292 if thats okay -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #9 from David Cook <dcook@prosentient.com.au> --- (In reply to Jan Kissig from comment #8)
The same error applies for opac-readingrecord.pl but I would fix that in 42292 if thats okay
Sure -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 --- Comment #10 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #9)
(In reply to Jan Kissig from comment #8)
The same error applies for opac-readingrecord.pl but I would fix that in 42292 if thats okay
Sure
Although... maybe not as that will cause backporting issues... probably worth raising a ticket if only for older versions. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42611 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=42912 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org