[freeside-commits] branch master updated. e1aa1019e11d7a73fcf90a87dd59c71ed90adce5

Mark Wells mark at 420.am
Tue Dec 22 17:23:42 PST 2015


The branch, master has been updated
       via  e1aa1019e11d7a73fcf90a87dd59c71ed90adce5 (commit)
       via  cad256dd690aa4607f3715f2140d77dff4a4bd68 (commit)
       via  0f686ba7d471d936a6623000ecbe23c152f29500 (commit)
      from  d102d05f9b43d77870d5a0ebdb93bf743f479e8d (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 e1aa1019e11d7a73fcf90a87dd59c71ed90adce5
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 22 17:03:07 2015 -0800

    improve handling of internal errors from US Census geocoding, #39549

diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index e83d6dc..aa4e55e 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -11,6 +11,7 @@ use Cpanel::JSON::XS;
 use URI::Escape 3.31;
 use Data::Dumper;
 use FS::Conf;
+use FS::Log;
 use Locale::Country;
 
 FS::UID->install_callback( sub {
@@ -300,6 +301,8 @@ sub standardize_usps {
 sub standardize_uscensus {
   my $self = shift;
   my $location = shift;
+  my $log = FS::Log->new('FS::Misc::Geo::standardize_uscensus');
+  $log->debug(join("\n", @{$location}{'address1', 'city', 'state', 'zip'}));
 
   eval "use Geo::USCensus::Geocoding";
   die $@ if $@;
@@ -322,6 +325,7 @@ sub standardize_uscensus {
   my $result = Geo::USCensus::Geocoding->query($request);
   if ( $result->is_match ) {
     # unfortunately we get the address back as a single line
+    $log->debug($result->address);
     if ($result->address =~ /^(.*), (.*), ([A-Z]{2}), (\d{5}.*)$/) {
       return +{
         address1    => $1,
@@ -341,8 +345,8 @@ sub standardize_uscensus {
   } elsif ( $result->match_level ) {
     die "Geocoding did not find a matching address.\n";
   } else {
-    warn Dumper($result) if $DEBUG;
-    die $result->error_message;
+    $log->error($result->error_message);
+    return; # for internal errors, don't return anything
   }
 }
 
diff --git a/FS/FS/geocode_Mixin.pm b/FS/FS/geocode_Mixin.pm
index 0625b5a..bc8c118 100644
--- a/FS/FS/geocode_Mixin.pm
+++ b/FS/FS/geocode_Mixin.pm
@@ -140,7 +140,7 @@ Returns the full country name.
 
 sub country_full {
   my $self = shift;
-  $self->code2country($self->country);
+  $self->code2country($self->get('country'));
 }
 
 sub code2country {
diff --git a/FS/FS/log.pm b/FS/FS/log.pm
index 0c23b12..95bc4c4 100644
--- a/FS/FS/log.pm
+++ b/FS/FS/log.pm
@@ -148,7 +148,7 @@ sub check {
     || $self->ut_textn('tablename')
     || $self->ut_numbern('tablenum')
     || $self->ut_number('level')
-    || $self->ut_text('message')
+    || $self->ut_anything('message')
   ;
   return $error if $error;
 
diff --git a/FS/FS/log_context.pm b/FS/FS/log_context.pm
index ff34717..9dba582 100644
--- a/FS/FS/log_context.pm
+++ b/FS/FS/log_context.pm
@@ -10,6 +10,7 @@ my @contexts = ( qw(
   FS::cust_main::Billing::bill_and_collect
   FS::cust_main::Billing::bill
   FS::pay_batch::import_from_gateway
+  FS::Misc::Geo::standardize_uscensus
   Cron::bill
   Cron::backup
   Cron::upload
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index b824fb2..0c4fb02 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -114,7 +114,12 @@ function confirm_standardize(arg) {
 
     // then all entered address fields are correct
     // but we still need to set the lat/long fields and addr_clean
-    status_message('Verified');
+
+    if ( returned['addr_clean'] ) {
+      status_message('Verified');
+    } else {
+      status_message('Unverified');
+    }
     replace_address();
 
   } else {
diff --git a/httemplate/search/log.html b/httemplate/search/log.html
index a707928..b607f50 100644
--- a/httemplate/search/log.html
+++ b/httemplate/search/log.html
@@ -138,7 +138,7 @@ my $tt_sub = sub {
   return '' if @context == 1 and length($log->message) <= 60;
   my $html = '<DIV CLASS="tooltip">'.(shift @context).'</DIV>';
   my $pre = '↳';
-  foreach (@context, $log->message) {
+  foreach (map encode_entities($_), @context, $log->message) {
     $html .= "<DIV>$pre$_</DIV>";
     $pre = '   '.$pre;
   }

commit cad256dd690aa4607f3715f2140d77dff4a4bd68
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Dec 22 17:02:02 2015 -0800

    UI nit

diff --git a/httemplate/view/cust_main/packages/location.html b/httemplate/view/cust_main/packages/location.html
index 99d91e5..595d6b3 100644
--- a/httemplate/view/cust_main/packages/location.html
+++ b/httemplate/view/cust_main/packages/location.html
@@ -91,7 +91,7 @@ sub pkg_change_location_link {
     'actionlabel' => emt('Change'),
     'cust_pkg'    => $cust_pkg,
     'width'       => 960,
-    'height'      => 490,
+    'height'      => 530,
   );
 }
 
diff --git a/httemplate/view/cust_main/packages/package.html b/httemplate/view/cust_main/packages/package.html
index e98b95e..dec1c6f 100644
--- a/httemplate/view/cust_main/packages/package.html
+++ b/httemplate/view/cust_main/packages/package.html
@@ -371,7 +371,7 @@ sub pkg_change_location_link {
     'actionlabel' => emt('Change'),
     'cust_pkg'    => $cust_pkg,
     'width'       => 960,
-    'height'      => 490,
+    'height'      => 530,
   );
 }
 

commit 0f686ba7d471d936a6623000ecbe23c152f29500
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Dec 21 15:58:32 2015 -0800

    fix misplaced merge onto devel branch, #32250

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index eec719a..7dbc2eb 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4289,7 +4289,6 @@ and customer address. Include units.',
     'section'     => 'invoicing',
     'description' => 'Instead of showing payments (and credits) applied to the invoice, show those received since the previous invoice date.',
     'type'        => 'checkbox',
-                       'uscensus' => 'U.S. Census Bureau',
   },
 
   {
@@ -4322,6 +4321,7 @@ and customer address. Include units.',
     'description' => 'Method for standardizing customer addresses.',
     'type'        => 'select',
     'select_hash' => [ '' => '', 
+                       'uscensus' => 'U.S. Census Bureau',
                        'usps'     => 'U.S. Postal Service',
                        'tomtom'   => 'TomTom',
                        'melissa'  => 'Melissa WebSmart',

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

Summary of changes:
 FS/FS/Conf.pm                                    |    2 +-
 FS/FS/Misc/Geo.pm                                |    8 ++++++--
 FS/FS/geocode_Mixin.pm                           |    2 +-
 FS/FS/log.pm                                     |    2 +-
 FS/FS/log_context.pm                             |    1 +
 httemplate/elements/standardize_locations.js     |    7 ++++++-
 httemplate/search/log.html                       |    2 +-
 httemplate/view/cust_main/packages/location.html |    2 +-
 httemplate/view/cust_main/packages/package.html  |    2 +-
 9 files changed, 19 insertions(+), 9 deletions(-)




More information about the freeside-commits mailing list