From 8aaa7c1853512244920ed0d547c26c24990ce22a Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 9 Nov 2009 18:30:11 +0000 Subject: [PATCH] patch from Lebbeous Fogle-Weekley to make address clipboard copying come from a string property instead of hard-coded format git-svn-id: svn://svn.open-ils.org/ILS/trunk@14843 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../server/locale/en-US/patron.properties | 3 ++ .../xul/staff_client/server/patron/summary.xul | 33 +++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 123a0f54a9..69a26800ae 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -348,6 +348,9 @@ staff.patron.field.hidden= # The < and > highlight that the value is not set; translate Unset and change the delimiters as needed staff.patron.field.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=
Replaces address %1$s
%2$s %3$s
%4$s, %5$s %6$s
diff --git a/Open-ILS/xul/staff_client/server/patron/summary.xul b/Open-ILS/xul/staff_client/server/patron/summary.xul index 01672702da..d77ac66137 100644 --- a/Open-ILS/xul/staff_client/server/patron/summary.xul +++ b/Open-ILS/xul/staff_client/server/patron/summary.xul @@ -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() { -- 2.11.0