Bug 21406

Summary: Not adding author to request can cause JS errors
Product: Koha Reporter: Andrew Isherwood <bugzilla>
Component: ILLAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: liz, lucas, martin.renvoize, mkstephens, nick
Version: 18.11   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 21406: [18.11.x only] Prevent errors from undefined fields in requests
Bug 21406: [18.11.x only] Prevent errors from undefined fields in requests

Description Andrew Isherwood 2018-09-25 09:08:00 UTC
If an ILL request does not contain an author, when viewing the ILL requests table, the following errors are displayed by Datatables:

DataTables warning: table id=ill-requests - Requested unknown parameter 'metadata_Author' for row 0, column 0. For more information about this error, please see http://datatables.net/tn/4

DataTables warning: table id=ill-requests - Requested unknown parameter 'metadata_Author' for row 358, column 0. For more information about this error, please see http://datatables.net/tn/4

We need better handling of requests without populated author in the JS
Comment 1 Myka Kennedy Stephens 2019-09-05 00:27:09 UTC
+1 Agreed.
I have noticed that the table that generates in the OPAC view adds 'N/A' to the author field. Perhaps the JS for the staff client table could be amended to insert "N/A" when the author field is absent.
Comment 2 Andrew Isherwood 2019-09-05 12:45:35 UTC
I'm not actually seeing this any more on master. There have been a lot of changes to both the ILL template and the associated JS since this bug was created, so it's highly likely it was fixed. I've looked through the commits to try and identify where it was fixed, but there are so many and some are so far reaching that I gave up. Suffice it to say, this is now fixed!

I'll mark this bug "Resolved"
Comment 3 Myka Kennedy Stephens 2019-09-05 13:03:52 UTC
We are on 18.11.08 with the Free Form backend and are experiencing this error. Would it be possible to still get a patch backported to 18.11.x?
Comment 4 Myka Kennedy Stephens 2019-09-05 13:53:08 UTC
Nick Clemens tracked it down to bug 18589, which made it to 19.05 and won't be backported to 18.11.x. Our library is scheduled to be upgraded to 19.05 in about 2 months, so we will just wait. Thanks!
Comment 5 Nick Clemens 2019-09-05 13:56:55 UTC
Created attachment 92608 [details] [review]
Bug 21406: [18.11.x only] Prevent errors from undefined fields in requests

To test:
1 - In 18.11 enable ILL and install the freeform backend
2 - Create a request for 'Journal article'
3 - Note there is no 'Author' field
4 - Try to view ILL requests
5 - You get a datatables error about missing metadata_author column
6 - Apply patch
7 - No more error
Comment 6 Andrew Isherwood 2019-09-05 13:57:11 UTC
Clearly Nick's sleuthing skills are far superior to mine, either that or he just doesn't give up so easily. Anyway, glad he was able to track it down!
Comment 7 Myka Kennedy Stephens 2019-09-05 16:05:59 UTC
Tested patch. Works as expected.
Results of test:
1. Applied patch.
2. Created journal article request, filling in values for fields provided (no author field)
3. Viewed list of ILL Requests. No error or warning message.
4. Author field for new journal article request says "N/A"

Thank you!!
Comment 8 Martin Renvoize 2019-10-29 11:14:07 UTC
Created attachment 94824 [details] [review]
Bug 21406: [18.11.x only] Prevent errors from undefined fields in requests

To test:
1 - In 18.11 enable ILL and install the freeform backend
2 - Create a request for 'Journal article'
3 - Note there is no 'Author' field
4 - Try to view ILL requests
5 - You get a datatables error about missing metadata_author column
6 - Apply patch
7 - No more error

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2019-10-29 11:14:31 UTC
Works as expected, passing QA
Comment 10 Lucas Gass 2019-11-06 17:14:38 UTC
backported to 18.11.x for 18.11.11