[open-ils-commits] r14848 - trunk/Open-ILS/xul/staff_client/server/patron (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 9 16:10:27 EST 2009
Author: erickson
Date: 2009-11-09 16:10:22 -0500 (Mon, 09 Nov 2009)
New Revision: 14848
Modified:
trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
Log:
subsequent patch from Lebbeous Fogle-Weekley to prevent display of bare nulls in address template
Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.xul 2009-11-09 18:54:49 UTC (rev 14847)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.xul 2009-11-09 21:10:22 UTC (rev 14848)
@@ -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
);
- // Without the following call to replace(), you get
- // literal instances of '\n' in the string.
- copy_to_clipboard(s.replace(/(\\n)+/g, "\n"));
+ // Replace literal instances of '\n' and excessive whitespace.
+ copy_to_clipboard(
+ s.replace(/(\\n)+/g, "\n").replace(/ {2,}/g, " ")
+ );
}
function copy_mailing_address() {
More information about the open-ils-commits
mailing list