From 2b56ae1d4a231a83f52420ec9efc4829226fa86a Mon Sep 17 00:00:00 2001 From: Didier Gautheron Date: Tue, 28 Apr 2020 07:43:46 +0200 Subject: [PATCH] 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 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 Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 6e639bc533..41c3562a67 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -289,10 +289,10 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - title = "" - + oObj.title.escapeHtml(); + + (oObj.title ? oObj.title.escapeHtml() : '' ); $.each(oObj.subtitle, function( index, value ) { title += " " + value.escapeHtml(); @@ -369,7 +369,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.homebranch.escapeHtml(); + return (oObj.homebranch ? oObj.homebranch.escapeHtml() : '' ); } }, { @@ -382,7 +382,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.branchname.escapeHtml(); + return (oObj.branchname ? oObj.branchname.escapeHtml() : '' ); } }, { @@ -663,10 +663,10 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - title = "" - + oObj.title.escapeHtml(); + + (oObj.title ? oObj.title.escapeHtml() : '' ); $.each(oObj.subtitle, function( index, value ) { title += " " + value.escapeHtml(); @@ -751,7 +751,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.branchname.escapeHtml(); + return ( oObj.branchname ? oObj.branchname.escapeHtml() : '' ); } }, { -- 2.39.5