From 12a767ba2d05603219bcc59a40f4ad7fba277948 Mon Sep 17 00:00:00 2001 From: Jeff Godin Date: Mon, 10 Oct 2011 16:18:49 -0400 Subject: [PATCH] Better handling of undefined values in receipts Teach escape_html to return an empty string when given an undefined value as input. Previously: a macro being replaced with an undefined value resulted in the macro itself remaining in the output. Now: a macro being replaced with an undefined value will result in an empty string in the output. --- Open-ILS/xul/staff_client/chrome/content/util/print.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js index 49fa358a84..bb3b6116eb 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js @@ -96,7 +96,11 @@ util.print.prototype = { }, 'escape_html' : function(data) { - return data.replace(/&/g,'&').replace(//g,'>'); + if (data) { + return data.replace(/&/g,'&').replace(//g,'>'); + } else { + return ''; + } }, 'simple' : function(msg,params) { -- 2.11.0