From bc49cb0b13658131c033fd803f0a3ad741200226 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 (cherry picked from commit 2b56ae1d4a231a83f52420ec9efc4829226fa86a) Signed-off-by: Lucas Gass (cherry picked from commit 6cbd0a6257dabab98959d2c5a090fca84213eefa) Signed-off-by: Aleisha Amohia --- 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 2145fd50b1..83a391b5fc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -288,10 +288,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(); @@ -368,7 +368,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.homebranch.escapeHtml(); + return (oObj.homebranch ? oObj.homebranch.escapeHtml() : '' ); } }, { @@ -381,7 +381,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.branchname.escapeHtml(); + return (oObj.branchname ? oObj.branchname.escapeHtml() : '' ); } }, { @@ -671,10 +671,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(); @@ -759,7 +759,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.branchname.escapeHtml(); + return ( oObj.branchname ? oObj.branchname.escapeHtml() : '' ); } }, { -- 2.39.5