summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_main
diff options
context:
space:
mode:
authorjeff <jeff>2009-06-29 13:53:25 +0000
committerjeff <jeff>2009-06-29 13:53:25 +0000
commit55f003404af6a2416571138356d11c5ad3755e58 (patch)
tree3f57ddfbe96b7057859857858f847324eef066bd /httemplate/edit/cust_main
parent7784bb1c43ea3031b2ca3bedf4b1a39aeb4ffe17 (diff)
FCC form 477 reporting #4912
Diffstat (limited to 'httemplate/edit/cust_main')
-rw-r--r--httemplate/edit/cust_main/bottomfixup.html7
-rw-r--r--httemplate/edit/cust_main/bottomfixup.js179
-rw-r--r--httemplate/edit/cust_main/choose_tax_location.html2
-rw-r--r--httemplate/edit/cust_main/contact.html1
4 files changed, 148 insertions, 41 deletions
diff --git a/httemplate/edit/cust_main/bottomfixup.html b/httemplate/edit/cust_main/bottomfixup.html
index 3eb43e0e5..1b29c671a 100644
--- a/httemplate/edit/cust_main/bottomfixup.html
+++ b/httemplate/edit/cust_main/bottomfixup.html
@@ -7,6 +7,13 @@
)
%>
+<% include( '/elements/xmlhttp.html',
+ 'url' => $p.'misc/xmlhttp-cust_main-censustract.html',
+ 'subs' => [ 'censustract' ],
+ #'method' => 'POST', #could get too long?
+ )
+%>
+
<SCRIPT TYPE="text/javascript">
<% include('bottomfixup.js') %>
</SCRIPT>
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index ae4aafb70..822f98d39 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -86,52 +86,17 @@ function update_address(arg) {
cf.elements['ship_zip'].value = argsHash['new_ship_zip'];
}
- }
-
- var cf = document.CustomerForm;
-
-% if ( $conf->exists('enable_taxproducts') ) {
-
- if ( <% $taxpre %>error ||
- new String(argsHash['new_<% $taxpre %>zip']).length < 10 )
- {
-
- var country_el = cf.elements['<% $taxpre %>country'];
- var country = country_el.options[ country_el.selectedIndex ].value;
-
- if ( country == 'CA' || country == 'US' ) {
-
- var state_el = cf.elements['<% $taxpre %>state'];
- var state = state_el.options[ state_el.selectedIndex ].value;
-
- var url = "cust_main/choose_tax_location.html" +
- "?data_vendor=cch-zip" +
- ";city=" + cf.elements['<% $taxpre %>city'].value +
- ";state=" + state +
- ";zip=" + cf.elements['<% $taxpre %>zip'].value +
- ";country=" + country +
- ";";
-
- // popup a chooser
- OLgetAJAX( url, update_geocode, 300 );
-
- } else {
-
- cf.elements['geocode'].value = 'DEFAULT';
- cf.submit();
+ post_standardization();
- }
+ }
- } else
-% }
if ( changed || ship_changed ) {
% if ( $conf->exists('cust_main-auto_standardize_address') ) {
standardize_address();
- cf.submit();
% } else {
@@ -198,9 +163,9 @@ function update_address(arg) {
confirm_change = confirm_change +
'<TR><TD>' +
- '<BUTTON TYPE="button" onClick="document.CustomerForm.submit();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' +
+ '<BUTTON TYPE="button" onClick="post_standardization();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' +
'</TD><TD>' +
- '<BUTTON TYPE="button" onClick="standardize_address(); document.CustomerForm.submit();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' +
+ '<BUTTON TYPE="button" onClick="standardize_address();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' +
'</TD></TR>' +
'<TR><TD COLSPAN=2 ALIGN="center">' +
'<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' +
@@ -213,10 +178,85 @@ function update_address(arg) {
} else {
- cf.submit();
+ post_standardization();
+
+ }
+
+
+}
+
+function post_standardization() {
+
+ var cf = document.CustomerForm;
+
+% if ( $conf->exists('enable_taxproducts') ) {
+
+ if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 )
+ {
+
+ var country_el = cf.elements['<% $taxpre %>country'];
+ var country = country_el.options[ country_el.selectedIndex ].value;
+
+ if ( country == 'CA' || country == 'US' ) {
+
+ var state_el = cf.elements['<% $taxpre %>state'];
+ var state = state_el.options[ state_el.selectedIndex ].value;
+
+ var url = "cust_main/choose_tax_location.html" +
+ "?data_vendor=cch-zip" +
+ ";city=" + cf.elements['<% $taxpre %>city'].value +
+ ";state=" + state +
+ ";zip=" + cf.elements['<% $taxpre %>zip'].value +
+ ";country=" + country +
+ ";";
+
+ // popup a chooser
+ OLgetAJAX( url, update_geocode, 300 );
+
+ } else {
+
+ cf.elements['geocode'].value = 'DEFAULT';
+ post_geocode();
+
+ }
+
+ } else {
+
+ post_geocode();
}
+% } else {
+
+ post_geocode();
+
+% }
+
+}
+
+function post_geocode() {
+
+% if ( $conf->exists('cust_main-require_censustract') ) {
+
+ //alert('fetch census tract data');
+ var cf = document.CustomerForm;
+ var state_el = cf.elements['ship_state'];
+ var census_data = new Array(
+ 'year', '2008', // from config value?
+ 'address', cf.elements['ship_address1'].value,
+ 'city', cf.elements['ship_city'].value,
+ 'state', state_el.options[ state_el.selectedIndex ].value,
+ 'zip', cf.elements['ship_zip'].value
+ );
+
+ censustract( census_data, update_censustract );
+
+% }else{
+
+ document.CustomerForm.submit();
+
+% }
+
}
function update_geocode() {
@@ -232,6 +272,7 @@ function update_geocode() {
setselect(cf.elements['<% $taxpre %>state'], argsHash['state']);
cf.elements['<% $taxpre %>zip'].value = argsHash['zip'];
cf.elements['geocode'].value = argsHash['geocode'];
+ post_geocode();
}
@@ -241,6 +282,64 @@ function update_geocode() {
}
+var set_censustract;
+
+function update_censustract(arg) {
+
+ var argsHash = eval('(' + arg + ')');
+
+ var cf = document.CustomerForm;
+
+ var msacode = argsHash['msacode'];
+ var statecode = argsHash['statecode'];
+ var countycode = argsHash['countycode'];
+ var tractcode = argsHash['tractcode'];
+ var error = argsHash['error'];
+
+ set_censustract = function () {
+
+ cf.elements['censustract'].value =
+ document.forms.popupcensustract.elements.censustract.value;
+ cf.submit();
+
+ }
+
+ if (error) {
+ // popup an entry dialog
+
+ var choose_censustract =
+ '<CENTER><BR><B>Enter census tract</B><BR><BR>' +
+ '<FORM name="popupcensustract">' +
+ '<TABLE>';
+
+ choose_censustract = choose_censustract +
+ '<TR><TH>Census Tract: </TH>' +
+ '<TD><INPUT NAME="censustract" ID="censustract"></TD>' +
+ '</TR><TR>' +
+ '<TD>&nbsp;</TD><TD>&nbsp;</TD></TR>';
+
+ choose_censustract = choose_censustract +
+ '<TR><TD>' +
+ '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT="">Submit census tract</BUTTON>' +
+ '</TD><TD>' +
+ '<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' +
+ '</TABLE></FORM></CENTER>';
+
+ overlib( choose_censustract, CAPTION, 'Choose a census tract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 );
+
+ setTimeout("document.forms.popupcensustract.elements.censustract.focus()",1);
+ } else {
+
+ cf.elements['censustract'].value =
+ new String(statecode) +
+ new String(countycode) +
+ new String(tractcode);
+ cf.submit();
+
+ }
+
+}
+
function copyelement(from, to) {
if ( from == undefined ) {
to.value = '';
diff --git a/httemplate/edit/cust_main/choose_tax_location.html b/httemplate/edit/cust_main/choose_tax_location.html
index 2a4192632..be93a5de8 100644
--- a/httemplate/edit/cust_main/choose_tax_location.html
+++ b/httemplate/edit/cust_main/choose_tax_location.html
@@ -26,7 +26,7 @@
</SELECT><BR><BR>
<TABLE><TR>
- <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes')); document.CustomerForm.submit();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD>
+ <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes'));"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD>
<TD><BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission </BUTTON></TD>
</TR>
</TABLE>
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index 27dd38516..2691da652 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -32,6 +32,7 @@
'disabled' => $disabled,
'same_checked' => $opt{'same_checked'},
'geocode' => $opt{'geocode'},
+ 'censustract' => $opt{'censustract'},
)
%>