From 340d4c77172e6deb3f72be154ff0518102aa6154 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 24 Aug 2018 16:22:20 -0300 Subject: [PATCH] Bug 21257: (bug 13618 follow-up) Handle undef values in JS before escapeHtml call To test: 1 - Find an item with no collection or location defined 2 - Check it out to a patron 3 - Note you cannot view the checkouts table 4 - Check the console: TypeError: oObj.collection is null 5 - Apply patch 6 - Restart all the things 7 - Checkouts table should load Signed-off-by: Katrin Fischer Signed-off-by: Christopher Brannon Signed-off-by: Chris Cormack --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 2525f567c7..b964a9cd8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -297,12 +297,12 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.collection.escapeHtml(); + return ( oObj.collection ? oObj.collection.escapeHtml() : '' ); } }, { "mDataProp": function ( oObj ) { - return oObj.location.escapeHtml(); + return ( oObj.location ? oObj.location.escapeHtml() : '' ); } }, { @@ -318,7 +318,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.itemcallnumber.escapeHtml(); + return ( oObj.itemcallnumber ? oObj.itemcallnumber.escapeHtml() : '' ); } }, { @@ -638,12 +638,12 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.collection.escapeHtml(); + return ( oObj.collection ? oObj.collection.escapeHtml() : '' ); } }, { "mDataProp": function ( oObj ) { - return oObj.location.escapeHtml(); + return ( oObj.location ? oObj.location.escapeHtml() : '' ); } }, { "mDataProp": "issuedate_formatted" }, @@ -654,7 +654,7 @@ $(document).ready(function() { }, { "mDataProp": function ( oObj ) { - return oObj.itemcallnumber.escapeHtml(); + return ( oObj.itemcallnumber ? oObj.itemcallnumber.escapeHtml() : '' ); } }, { -- 2.11.0