1 function bottomfixup(what) {
4 var layervars = new Array(
6 'payinfo', 'payinfo1', 'payinfo2', 'payinfo3', 'paytype',
7 'payname', 'paystate', 'exp_month', 'exp_year', 'paycvv',
8 'paystart_month', 'paystart_year', 'payissue',
13 var cf = document.CustomerForm;
14 var payby = cf.payby.options[cf.payby.selectedIndex].value;
15 for ( f=0; f < layervars.length; f++ ) {
16 var field = layervars[f];
17 copyelement( cf.elements[payby + '_' + field],
22 //this part does USPS address correction
23 standardize_locations();
27 <% include( '/elements/standardize_locations.js',
28 'callback', 'post_geocode();'
32 function post_geocode() {
34 % if ( $conf->exists('cust_main-require_censustract') ) {
36 //alert('fetch census tract data');
37 var cf = document.CustomerForm;
38 var state_el = cf.elements['ship_state'];
39 var census_data = new Array(
40 'year', <% $conf->config('census_year') || '2011' %>,
41 'address', cf.elements['ship_address1'].value,
42 'city', cf.elements['ship_city'].value,
43 'state', state_el.options[ state_el.selectedIndex ].value,
44 'zip', cf.elements['ship_zip'].value
47 censustract( census_data, update_censustract );
51 document.CustomerForm.submit();
59 function update_censustract(arg) {
61 var argsHash = eval('(' + arg + ')');
63 var cf = document.CustomerForm;
65 var msacode = argsHash['msacode'];
66 var statecode = argsHash['statecode'];
67 var countycode = argsHash['countycode'];
68 var tractcode = argsHash['tractcode'];
69 var error = argsHash['error'];
72 new String(statecode) +
73 new String(countycode) +
74 new String(tractcode).replace(/\s$/, ''); // JSON 1 workaround
76 set_censustract = function () {
78 cf.elements['censustract'].value = newcensus
83 if (error || cf.elements['censustract'].value != newcensus) {
84 // popup an entry dialog
86 if (error) { newcensus = error; }
87 newcensus.replace(/.*ndefined.*/, 'Not found');
89 var choose_censustract =
90 '<CENTER><BR><B>Confirm censustract</B><BR>' +
91 '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
92 'census_year=<% $conf->config('census_year') || '2008' %>' +
93 '&latitude=' + cf.elements['latitude'].value +
94 '&longitude=' + cf.elements['longitude'].value +
95 '" target="_blank">Map service module location</A><BR>' +
96 '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
97 'census_year=<% $conf->config('census_year') || '2008' %>' +
98 '&zip_code=' + cf.elements['ship_zip'].value +
99 '" target="_blank">Map zip code center</A><BR><BR>' +
102 choose_censustract = choose_censustract +
103 '<TR><TH style="width:50%">Entered census tract</TH>' +
104 '<TH style="width:50%">Calculated census tract</TH></TR>' +
105 '<TR><TD>' + cf.elements['censustract'].value +
106 '</TD><TD>' + newcensus + '</TD></TR>' +
107 '<TR><TD> </TD><TD> </TD></TR>';
109 choose_censustract = choose_censustract +
110 '<TR><TD ALIGN="center">' +
111 '<BUTTON TYPE="button" onClick="document.CustomerForm.submit();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract </BUTTON>' +
112 '</TD><TD ALIGN="center">' +
113 '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract </BUTTON>' +
115 '<TR><TD COLSPAN=2 ALIGN="center">' +
116 '<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' +
120 overlib( choose_censustract, CAPTION, 'Confirm censustract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 );
130 function copyelement(from, to) {
131 if ( from == undefined ) {
133 } else if ( from.type == 'select-one' ) {
134 to.value = from.options[from.selectedIndex].value;
135 //alert(from + " (" + from.type + "): " + to.name + " => (" + from.selectedIndex + ") " + to.value);
136 } else if ( from.type == 'checkbox' ) {
137 if ( from.checked ) {
138 to.value = from.value;
143 if ( from.value == undefined ) {
146 to.value = from.value;
149 //alert(from + " (" + from.type + "): " + to.name + " => " + to.value);
154 my $conf = new FS::Conf;