From 9dc88f6c738f30ce1eb6339ba4b739b45555dea4 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 8 May 2008 12:47:13 +0000 Subject: [PATCH] address standardization part one, finally checked in from here --- FS/FS/Conf.pm | 21 ++++++ htetc/handler.pl | 4 +- httemplate/edit/cust_main.cgi | 66 +++++++++++++++- httemplate/elements/xmlhttp.html | 16 ++++ .../xmlhttp-cust_main-address_standardize.html | 87 ++++++++++++++++++++++ httemplate/misc/xmlhttp-cust_main-search.cgi | 2 +- 6 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 httemplate/misc/xmlhttp-cust_main-address_standardize.html diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 2094ff0c9..3aa19b707 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2236,6 +2236,27 @@ worry that config_items is freeside-specific and icky. ], }, + { + 'key' => 'usps_webtools-userid', + 'section' => 'UI', + 'description' => 'Production UserID for USPS web tools. Enables USPS address standardization. See the USPS website, register and agree not to use the tools for batch purposes.', + 'type' => 'text', + }, + + { + 'key' => 'usps_webtools-password', + 'section' => 'UI', + 'description' => 'Production password for USPS web tools. Enables USPS address standardization. See USPS website, register and agree not to use the tools for batch purposes.', + 'type' => 'text', + }, + + { + 'key' => 'cust_main-auto_standardize_address', + 'section' => 'UI', + 'description' => 'When using USPS web tools, automatically standardize the address without asking.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/htetc/handler.pl b/htetc/handler.pl index d2fe52df0..5e34c1e0d 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -125,8 +125,10 @@ sub handler use Chart::LinesPoints; use Chart::Mountain; use Color::Scheme; - use HTML::Widgets::SelectLayers 0.07; + use HTML::Widgets::SelectLayers 0.07; #should go away in favor of + #selectlayers.html use Locale::Country; + use Business::US::USPS::WebTools::AddressStandardization; use FS; use FS::UID qw(cgisuidsetup dbh getotaker datasrc driver_name); use FS::Record qw(qsearch qsearchs fields dbdef str2time_sql); diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index aae809370..3d727dd2c 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -210,9 +210,19 @@ Service address ) %> +<% include( '/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-cust_main-address_standardize.html', + 'subs' => [ 'address_standardize' ], + #'method' => 'POST', #could get too long? + ) +%> + -
+ % foreach my $hidden ( % 'birthdate', % @@ -438,7 +500,7 @@ function copyelement(from, to) {
-"> +" onClick="document.bottomform.submitButton.disabled=true; bottomfixup(this.form);">
diff --git a/httemplate/elements/xmlhttp.html b/httemplate/elements/xmlhttp.html index 3f4462b94..d0c799095 100644 --- a/httemplate/elements/xmlhttp.html +++ b/httemplate/elements/xmlhttp.html @@ -1,3 +1,19 @@ +<%doc> + +Example: + + include( '/elements/xmlhttp.html', + # required + 'url' => $p.'misc/something.html', + 'subs' => [ 'subroutine' ], + + # optional + 'method' => 'GET', #defaults to GET, could specify POST + 'key' => 'unique', #unique key + + ); + +