[freeside-commits] branch FREESIDE_3_BRANCH updated. 2d5acabf71d46aa469a6867f294706242c82db98

Mark Wells mark at 420.am
Wed Nov 26 16:55:45 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  2d5acabf71d46aa469a6867f294706242c82db98 (commit)
      from  d51f9090afefa9e29200fc1df6e88e8c24a55657 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2d5acabf71d46aa469a6867f294706242c82db98
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 26 16:55:30 2014 -0800

    don't look up or display census tracts for non-U.S. addresses, #32249

diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index eb861f3..4ef1085 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -42,6 +42,10 @@ sub get_censustract_ffiec {
   my $location = shift;
   my $year  = shift;
 
+  if ( length($location->{country}) and uc($location->{country}) ne 'US' ) {
+    return '';
+  }
+
   warn Dumper($location, $year) if $DEBUG;
 
   my $url = 'http://www.ffiec.gov/Geocode/default.aspx';
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index 5a8835f..8aef1e7 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -116,10 +116,13 @@ function confirm_censustract(pre) {
         '<%$p%>/misc/confirm-censustract.html',
         'q=' + encodeURIComponent(JSON.stringify(address_info)),
         function() {
-          overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
-            AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
-            576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
-            TEXTSIZE, 3 );
+          if ( OLresponseAJAX ) {
+            overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
+              AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
+              576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
+              TEXTSIZE, 3 );
+          } else
+            submit_continue();
         },
         0);
   } else submit_continue();
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index 2d1fc74..307f822 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -293,10 +293,15 @@ function confirm_censustract() {
         '<%$p%>/misc/confirm-censustract.html',
         'q=' + encodeURIComponent(JSON.stringify(address_info)),
         function() {
-          overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
-            AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
-            576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
-            TEXTSIZE, 3 );
+          if ( OLresponseAJAX ) {
+            overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY,
+              AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
+              576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
+              TEXTSIZE, 3 );
+          } else {
+            // no response
+            <% $post_censustract %>;
+          }
         },
         0);
   } else {
diff --git a/httemplate/elements/tr-censustract.html b/httemplate/elements/tr-censustract.html
index bd014f1..7a4b349 100644
--- a/httemplate/elements/tr-censustract.html
+++ b/httemplate/elements/tr-censustract.html
@@ -1,4 +1,4 @@
-% if ($censustract) {
+% if ($location->country eq 'US' and $censustract) {
 <TR>
   <TD ALIGN="right"><% mt('Census tract') |h %></TD>
   <TD COLSPAN=5>
diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html
index 880cade..024bc17 100644
--- a/httemplate/misc/confirm-censustract.html
+++ b/httemplate/misc/confirm-censustract.html
@@ -1,3 +1,10 @@
+% if ( !$error and !$new_tract ) {
+%   # then set_censustract returned nothing
+%   # because it's not relevant for this address
+%   # so output nothing (forces confirm_censustract() to continue)
+% $m->clear_buffer;
+% $m->abort;
+% }
 <CENTER><BR><B>
 % if ( $error ) {
 Census tract error
diff --git a/httemplate/view/cust_main/locations.html b/httemplate/view/cust_main/locations.html
index fdbbc39..336c1aa 100755
--- a/httemplate/view/cust_main/locations.html
+++ b/httemplate/view/cust_main/locations.html
@@ -35,16 +35,18 @@ table.location {
 <TH COLSPAN=5>
 <DIV CLASS="<% $loc->disabled ? 'loclabel disabled' : 'loclabel' %>">
 <% $loc->location_label %>
-%   if ( $loc->censustract ) {
-        <BR>
-        <FONT SIZE=-1>
-        <% $loc->censustract %> (<% $loc->censusyear %> census)
-        </FONT>
-%   } elsif ( $conf->exists('cust_main-require_censustract') ) {
-        <BR>
-        <FONT SIZE=-1 COLOR="#ee3300">
-        <% emt('Census tract unknown') %>
-        </FONT>
+%   if ( $loc->country eq 'US' ) { # only U.S. census tracts for now
+%     if ( $loc->censustract ) {
+          <BR>
+          <FONT SIZE=-1>
+          <% $loc->censustract %> (<% $loc->censusyear %> census)
+          </FONT>
+%     } elsif ( $conf->exists('cust_main-require_censustract') ) {
+          <BR>
+          <FONT SIZE=-1 COLOR="#ee3300">
+          <% emt('Census tract unknown') %>
+          </FONT>
+%     }
 %   }
 </DIV>
 <DIV STYLE="display: inline; float:right;">
diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html
index c5ef10e..99d91e5 100644
--- a/httemplate/view/cust_main/packages/location.html
+++ b/httemplate/view/cust_main/packages/location.html
@@ -30,16 +30,18 @@
           &>
           </FONT>
 %     }
-%     if ( $loc->censustract ) {
-         <BR>
-         <FONT SIZE=-1>
-         <% $loc->censustract %> (<% $loc->censusyear %> census)
-         </FONT>
-%     } elsif ( $opt{'cust_main-require_censustract'} ) {
-          <BR>
-          <FONT SIZE=-1 COLOR="#ee3300">
-          <% emt('Census tract unknown') %>
-          </FONT>
+%     if ( $loc->country eq 'US' ) {
+%       if ( $loc->censustract ) {
+           <BR>
+           <FONT SIZE=-1>
+           <% $loc->censustract %> (<% $loc->censusyear %> census)
+           </FONT>
+%       } elsif ( $opt{'cust_main-require_censustract'} ) {
+            <BR>
+            <FONT SIZE=-1 COLOR="#ee3300">
+            <% emt('Census tract unknown') %>
+            </FONT>
+%       }
 %     }
 
 %     if ( $default ) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Misc/Geo.pm                                |    4 ++++
 httemplate/edit/cust_main/bottomfixup.js         |   11 +++++++----
 httemplate/elements/standardize_locations.js     |   13 +++++++++----
 httemplate/elements/tr-censustract.html          |    2 +-
 httemplate/misc/confirm-censustract.html         |    7 +++++++
 httemplate/view/cust_main/locations.html         |   22 ++++++++++++----------
 httemplate/view/cust_main/packages/location.html |   22 ++++++++++++----------
 7 files changed, 52 insertions(+), 29 deletions(-)




More information about the freeside-commits mailing list