From 05fd3fab825979eaba891c934abde79a80a1acea Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 9 Nov 2009 21:10:22 +0000 Subject: [PATCH] subsequent patch from Lebbeous Fogle-Weekley to prevent display of bare nulls in address template git-svn-id: svn://svn.open-ils.org/ILS/trunk@14848 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/summary.xul | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/summary.xul b/Open-ILS/xul/staff_client/server/patron/summary.xul index d77ac66137..3e117f3998 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary.xul @@ -78,15 +78,21 @@ function copy_address(a) { var p = g.summary.patron; + var parts = [ + p.first_given_name(), p.second_given_name(), p.family_name(), + a.street1(), a.street2(), a.city(), a.county(), + a.state(), a.post_code(), a.country() + ]; + for (var i = 0; i < parts.length; i++) + if (parts[i] == null) parts[i] = ""; + var s = $("patronStrings").getFormattedString( - 'staff.patron.mailable_address_format', - [p.first_given_name(), p.second_given_name(), p.family_name(), - a.street1(), a.street2(), a.city(), a.county(), - a.state(), a.post_code(), a.country()] + 'staff.patron.mailable_address_format', parts + ); + // Replace literal instances of '\n' and excessive whitespace. + copy_to_clipboard( + s.replace(/(\\n)+/g, "\n").replace(/ {2,}/g, " ") ); - // Without the following call to replace(), you get - // literal instances of '\n' in the string. - copy_to_clipboard(s.replace(/(\\n)+/g, "\n")); } function copy_mailing_address() { -- 2.11.0