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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Didier Gautheron 2020-04-28 07:43:46 +02:00 committed by Jonathan Druart
parent a21a3bba6b
commit 2b56ae1d4a

View file

@ -289,10 +289,10 @@ $(document).ready(function() {
}, },
{ {
"mDataProp": function ( oObj ) { "mDataProp": function ( oObj ) {
title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" let title = "<span id='title_" + oObj.itemnumber + "' class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
+ oObj.biblionumber + oObj.biblionumber
+ "'>" + "'>"
+ oObj.title.escapeHtml(); + (oObj.title ? oObj.title.escapeHtml() : '' );
$.each(oObj.subtitle, function( index, value ) { $.each(oObj.subtitle, function( index, value ) {
title += " " + value.escapeHtml(); title += " " + value.escapeHtml();
@ -369,7 +369,7 @@ $(document).ready(function() {
}, },
{ {
"mDataProp": function ( oObj ) { "mDataProp": function ( oObj ) {
return oObj.homebranch.escapeHtml(); return (oObj.homebranch ? oObj.homebranch.escapeHtml() : '' );
} }
}, },
{ {
@ -382,7 +382,7 @@ $(document).ready(function() {
}, },
{ {
"mDataProp": function ( oObj ) { "mDataProp": function ( oObj ) {
return oObj.branchname.escapeHtml(); return (oObj.branchname ? oObj.branchname.escapeHtml() : '' );
} }
}, },
{ {
@ -663,10 +663,10 @@ $(document).ready(function() {
}, },
{ {
"mDataProp": function ( oObj ) { "mDataProp": function ( oObj ) {
title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" let title = "<span class='strong'><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
+ oObj.biblionumber + oObj.biblionumber
+ "'>" + "'>"
+ oObj.title.escapeHtml(); + (oObj.title ? oObj.title.escapeHtml() : '' );
$.each(oObj.subtitle, function( index, value ) { $.each(oObj.subtitle, function( index, value ) {
title += " " + value.escapeHtml(); title += " " + value.escapeHtml();
@ -751,7 +751,7 @@ $(document).ready(function() {
}, },
{ {
"mDataProp": function ( oObj ) { "mDataProp": function ( oObj ) {
return oObj.branchname.escapeHtml(); return ( oObj.branchname ? oObj.branchname.escapeHtml() : '' );
} }
}, },
{ {