From 7cdc3e89d553d111d32f2bf260a259d6698642a6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 2 Dec 2020 11:25:13 +0100 Subject: [PATCH] Bug 26797: Escape firstname to prevent relative's checkouts to crash If no firstname is defined for a relative, the "Relative's checkouts" tab will be "processing" forever. JS error: TypeError: oObj.borrower.firstname is null Test plan: 1 - Create a patron (PatronA) in a category with type 'Org' 'School' in sample data works 2 - Add a guarantee (Patron B) 3 - Check out an item to PatronA 4 - Go to PatronB's record and click relativwe's checkouts 5 - There is an error and the table doe snot load 6 - Apply patch 7 - Reload 8 - Table loads correctly Signed-off-by: Kelly McElligott Signed-off-by: Nick Clemens --- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 169c318877..91c015ebcb 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -819,10 +819,10 @@ $(document).ready(function() { { "mDataProp": function( oObj ) { return "" - + oObj.borrower.firstname.escapeHtml() + + ( oObj.borrower.firstname ? oObj.borrower.firstname.escapeHtml() : "" ) + " " + - oObj.borrower.surname.escapeHtml() - + " (" + oObj.borrower.cardnumber.escapeHtml() + ")" + ( oObj.borrower.surname ? oObj.borrower.surname.escapeHtml() : "" ) + + " (" + ( oObj.borrower.cardnumber ? oObj.borrower.cardnumber.escapeHtml() : "" ) + ")" } }, ], -- 2.11.0