[freeside-commits] freeside/httemplate/edit/cust_main bottomfixup.html, 1.1, 1.2 bottomfixup.js, 1.2, 1.3 choose_tax_location.html, 1.4, 1.5 contact.html, 1.12, 1.13

Jeff Finucane,420,, jeff at wavetail.420.am
Mon Jun 29 06:53:27 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit/cust_main
In directory wavetail.420.am:/tmp/cvs-serv21344/httemplate/edit/cust_main

Modified Files:
	bottomfixup.html bottomfixup.js choose_tax_location.html 
	contact.html 
Log Message:
FCC form 477 reporting #4912

Index: bottomfixup.js
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/bottomfixup.js,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bottomfixup.js	14 May 2009 16:26:40 -0000	1.2
+++ bottomfixup.js	29 Jun 2009 13:53:24 -0000	1.3
@@ -86,52 +86,17 @@
       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 @@
 
     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 @@
 
   } 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 @@
     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 @@
 
 }
 
+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 = '';

Index: bottomfixup.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/bottomfixup.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- bottomfixup.html	12 Apr 2009 06:09:11 -0000	1.1
+++ bottomfixup.html	29 Jun 2009 13:53:24 -0000	1.2
@@ -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>

Index: contact.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/contact.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- contact.html	9 Jan 2009 04:06:25 -0000	1.12
+++ contact.html	29 Jun 2009 13:53:25 -0000	1.13
@@ -32,6 +32,7 @@
              'disabled'     => $disabled,
              'same_checked' => $opt{'same_checked'},
              'geocode'      => $opt{'geocode'},
+             'censustract'  => $opt{'censustract'},
           )
 %>
 

Index: choose_tax_location.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/choose_tax_location.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- choose_tax_location.html	12 Apr 2009 06:09:12 -0000	1.4
+++ choose_tax_location.html	29 Jun 2009 13:53:24 -0000	1.5
@@ -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>



More information about the freeside-commits mailing list