[freeside-commits] branch 13763 updated. c0fbde80fbdba49ddd77cc6fc5460d3e3ba6b154

Mark Wells mark at 420.am
Fri Nov 2 14:31:17 PDT 2012


The branch, 13763 has been updated
       via  c0fbde80fbdba49ddd77cc6fc5460d3e3ba6b154 (commit)
      from  ee3fd4e95bdc52f15b0603a32363778f72d164ef (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 c0fbde80fbdba49ddd77cc6fc5460d3e3ba6b154
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Nov 2 14:28:04 2012 -0700

    rename teleatlas to "EZLocate" and switch to our API wrapper

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 43521ce..902c036 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4056,7 +4056,7 @@ and customer address. Include units.',
     'type'        => 'select',
     'select_hash' => [ '' => '', 
                        'usps' => 'U.S. Postal Service',
-                       'teleatlas' => 'TeleAtlas',
+                       'ezlocate' => 'EZLocate',
                      ],
   },
 
@@ -4075,24 +4075,17 @@ and customer address. Include units.',
   },
 
   {
-    'key'         => 'teleatlas-path',
+    'key'         => 'ezlocate-userid',
     'section'     => 'UI',
-    'description' => 'Path to TeleAtlas libraries on the Freeside server.',
+    'description' => 'User ID for EZ-Locate service.  See <a href="http://www.geocode.com/">the TomTom website</a> for access and pricing information.',
     'type'        => 'text',
   },
 
   {
-    'key'         => 'teleatlas-userid',
+    'key'         => 'ezlocate-password',
     'section'     => 'UI',
-    'description' => 'User ID for TeleAtlas EZ-Locate service.  See <a href="http://www.geocode.com/">the Tele Atlas website</a> for access and pricing information.',
-    'type'        => 'text',
-  },
-
-  {
-    'key'         => 'teleatlas-password',
-    'section'     => 'UI',
-    'description' => 'Password for TeleAtlas EZ-Locate service.',
-    'type'        => 'text',
+    'description' => 'Password for EZ-Locate service.',
+    'type'        => 'text'
   },
 
   {
diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index b727fa7..6bc71fc 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -328,7 +328,7 @@ sub standardize_usps {
     addr_clean=> 'Y' }
 }
 
-my %teleatlas_error = ( # USA_Geo_002 documentation
+my %ezlocate_error = ( # USA_Geo_002 documentation
   10  => 'State not found',
   11  => 'City not found',
   12  => 'Invalid street address',
@@ -338,35 +338,37 @@ my %teleatlas_error = ( # USA_Geo_002 documentation
   17  => 'Intersection not found', #unused?
 );
 
-sub standardize_teleatlas {
+sub standardize_ezlocate {
   my $self = shift;
   my $location = shift;
   my $class;
-  if ( $location->{country} eq 'US' ) {
-    $class = 'USA_Geo_004Tool';
-  }
-  elsif ( $location->{country} eq 'CA' ) {
-    $class = 'CAN_Geo_001Tool';
-  }
-  else { # shouldn't be a fatal error, just pass through unverified address
-    warn "standardize_teleatlas: address lookup in '".$location->{country}.
-         "' not available\n";
-    return $location;
-  }
-
-  my $path = $conf->config('teleatlas-path') || '';
-  local @INC = (@INC, $path);
-  eval "use $class;";
-  if ( $@ ) {
-    die "Loading $class failed:\n$@".
-        "\nMake sure the TeleAtlas Perl SDK is installed correctly.\n";
-  }
-
-  my $userid = $conf->config('teleatlas-userid')
-    or die "no teleatlas-userid configured\n";
-  my $password = $conf->config('teleatlas-password')
-    or die "no teleatlas-password configured\n";
+  #if ( $location->{country} eq 'US' ) {
+  #  $class = 'USA_Geo_004Tool';
+  #}
+  #elsif ( $location->{country} eq 'CA' ) {
+  #  $class = 'CAN_Geo_001Tool';
+  #}
+  #else { # shouldn't be a fatal error, just pass through unverified address
+  #  warn "standardize_teleatlas: address lookup in '".$location->{country}.
+  #       "' not available\n";
+  #  return $location;
+  #}
+  #my $path = $conf->config('teleatlas-path') || '';
+  #local @INC = (@INC, $path);
+  #eval "use $class;";
+  #if ( $@ ) {
+  #  die "Loading $class failed:\n$@".
+  #      "\nMake sure the TeleAtlas Perl SDK is installed correctly.\n";
+  #}
+
+  $class = 'Geo::EZLocate'; # use our own library
+  eval "use $class";
+  die $@ if $@;
 
+  my $userid = $conf->config('ezlocate-userid')
+    or die "no ezlocate-userid configured\n";
+  my $password = $conf->config('ezlocate-password')
+    or die "no ezlocate-password configured\n";
   
   my $tool = $class->new($userid, $password);
   my $match = $tool->findAddress(
@@ -375,9 +377,9 @@ sub standardize_teleatlas {
     $location->{state},
     $location->{zip}, #12345-6789 format is allowed
   );
-  warn "teleatlas returned match:\n".Dumper($match) if $DEBUG > 1;
+  warn "ezlocate returned match:\n".Dumper($match) if $DEBUG > 1;
   # error handling - B codes indicate success
-  die $teleatlas_error{$match->{MAT_STAT}}."\n"
+  die $ezlocate_error{$match->{MAT_STAT}}."\n"
     unless $match->{MAT_STAT} =~ /^B\d$/;
 
   {

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

Summary of changes:
 FS/FS/Conf.pm     |   19 +++++-----------
 FS/FS/Misc/Geo.pm |   58 +++++++++++++++++++++++++++-------------------------
 2 files changed, 36 insertions(+), 41 deletions(-)




More information about the freeside-commits mailing list