[open-ils-commits] r14843 - in trunk/Open-ILS/xul/staff_client/server: locale/en-US patron (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 9 13:30:14 EST 2009


Author: erickson
Date: 2009-11-09 13:30:11 -0500 (Mon, 09 Nov 2009)
New Revision: 14843

Modified:
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
   trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
Log:
patch from Lebbeous Fogle-Weekley to make address clipboard copying come from a string property instead of hard-coded format

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-11-09 16:14:28 UTC (rev 14842)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-11-09 18:30:11 UTC (rev 14843)
@@ -348,6 +348,9 @@
 # The < and > highlight that the value is not set; translate Unset and change the delimiters as needed
 staff.patron.field.unset=<Unset>
 
+# Unused by default but available: %7 is county; %10 is country.
+staff.patron.mailable_address_format=%1$s %2$s %3$s\n%4$s\n%5$s\n%6$s %8$s, %9$s
+
 web.staff.patron.ue.session_no_defined=User session is not defined
 web.staff.patron.ue.uedit_show_search.search_would_be=Search would be:\n%1$s
 web.staff.patron.ue.uedit_show_addr_replacement=<div>Replaces address <b>%1$s</b><br/> %2$s %3$s<br/> %4$s, %5$s %6$s</div>

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary.xul	2009-11-09 16:14:28 UTC (rev 14842)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary.xul	2009-11-09 18:30:11 UTC (rev 14843)
@@ -76,30 +76,29 @@
             }
         }
 
+        function copy_address(a) {
+            var p = g.summary.patron;
+            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()]
+            );
+            // 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() {
             var a = g.summary.patron.mailing_address();
             if (!a) return;
-            copy_to_clipboard(
-                (a.street1() ? a.street1() : "") + "\t" + 
-                (a.street2() ? a.street2() : "") + "\t" +  
-                (a.county() ? a.county() : "") + "\t" + 
-                (a.city() ? a.city() : "") + "\t" +  
-                (a.post_code() ? a.post_code() : "") + "\t" + 
-                (a.country() ? a.country() : "")
-            );
+            copy_address(a);
         }
-        
+
         function copy_billing_address() {
             var a = g.summary.patron.billing_address();
             if (!a) return;
-            copy_to_clipboard(
-                (a.street1() ? a.street1() : "") + "\t" + 
-                (a.street2() ? a.street2() : "") + "\t" +  
-                (a.county() ? a.county() : "") + "\t" + 
-                (a.city() ? a.city() : "") + "\t" +  
-                (a.post_code() ? a.post_code() : "") + "\t" + 
-                (a.country() ? a.country() : "")
-            );
+            copy_address(a);
         }
     
         function post_overlay() {



More information about the open-ils-commits mailing list