EscapeHtml is still called on many fields without testing if they exist: Uncaught TypeError: Cannot read property 'escapeHtml' of null Fields like title, branchcode and so on aren't guarantee to be not null. If they are, for whatever reason, broken items are often next to unfixable within Koha.
Created attachment 103862 [details] [review] Bug 25293: Don't call escapeHtml on null Test Plan: 1) Create two Checkouts 2) view patron's checkout list cgi-bin/koha/members/moremember.pl?borrowernumber=pp <show checkout> 3) in mysql shell delete a checkout home branch: update items set homebranch = null where itemnumber = xx; 4) view patron's checkout list, again Without this patch the list is empty. Same if biblio title is null (update biblio set title = null where biblionumber = yy;). Javascript error: TypeError: oObj.title is null
How an item can have a 'homebranch' field empty or how can a biblio record have no title?
(In reply to Frédéric Demians from comment #2) > How an item can have a 'homebranch' field empty or how can a biblio record > have no title? Hi, No idea, likely a bug somewhere, but they do. It seems that some imported MARC data can produce biblio records without title though. Anyway, both update items set homebranch = null where itemnumber = ...; and update biblio set title = null where biblionumber = ...; don't return an error, thus from the DB DDL POV they are valid, if they are not then something at the application level has to deal with it. checkouts.js is likely not the right place, only one with the fewer unexpected side effects. Regards Didier
(In reply to Frédéric Demians from comment #2) > How an item can have a 'homebranch' field empty or how can a biblio record > have no title? A biblio can not have a title if you not entered in biblio framework , some cataloguers do that for some special records.
I usually encounter this issue because of the Keyword To MARC mapping removal, which caused some really bad Koha to MARC mappings in the biblio. It caused a lot of problems for us.
*** Bug 25678 has been marked as a duplicate of this bug. ***
(In reply to David Cook from comment #5) > I usually encounter this issue because of the Keyword To MARC mapping > removal, which caused some really bad Koha to MARC mappings in the biblio. > > It caused a lot of problems for us. So, sign it off?
(In reply to Jonathan Druart from comment #7) > (In reply to David Cook from comment #5) > > I usually encounter this issue because of the Keyword To MARC mapping > > removal, which caused some really bad Koha to MARC mappings in the biblio. > > > > It caused a lot of problems for us. > > So, sign it off? That takes time and effort, and it isn't a local priority at the moment. It's on my TODO list, but it's a long list with other higher priorities. This issue almost always indicates a misconfiguration or bad data, so it's not really a critical issue. Since it's a non-critical issue, I could just sign it off, but I rather put the time in to test it fully. But that means it's not going to happen today.
Created attachment 106634 [details] [review] Bug 25293: Don't call escapeHtml on null Test Plan: 1) Create two Checkouts 2) view patron's checkout list cgi-bin/koha/members/moremember.pl?borrowernumber=pp <show checkout> 3) in mysql shell delete a checkout home branch: update items set homebranch = null where itemnumber = xx; 4) view patron's checkout list, again Without this patch the list is empty. Same if biblio title is null (update biblio set title = null where biblionumber = yy;). Javascript error: TypeError: oObj.title is null Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 106854 [details] [review] Bug 25293: Don't call escapeHtml on null Test Plan: 1) Create two Checkouts 2) view patron's checkout list cgi-bin/koha/members/moremember.pl?borrowernumber=pp <show checkout> 3) in mysql shell delete a checkout home branch: update items set homebranch = null where itemnumber = xx; 4) view patron's checkout list, again Without this patch the list is empty. Same if biblio title is null (update biblio set title = null where biblionumber = yy;). Javascript error: TypeError: oObj.title is null Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
There are also those two, but apparently they cannot be undefined 724 { 725 "mDataProp": function ( oObj ) { 726 return oObj.recordtype_description.escapeHtml(); 727 } 728 }, 729 { 730 "mDataProp": function ( oObj ) { 731 return oObj.itemtype_description.escapeHtml(); 732 } 733 },
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.03
backported to 19.11.x for 19.11.09
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.
*** Bug 27006 has been marked as a duplicate of this bug. ***