diff options
| author | Mark Wells <mark@freeside.biz> | 2012-11-02 14:28:04 -0700 | 
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-11-02 14:28:04 -0700 | 
| commit | c0fbde80fbdba49ddd77cc6fc5460d3e3ba6b154 (patch) | |
| tree | 10bf26d2d69b399a4b842c1e570b474c90d72384 | |
| parent | ee3fd4e95bdc52f15b0603a32363778f72d164ef (diff) | |
rename teleatlas to "EZLocate" and switch to our API wrapper13763
| -rw-r--r-- | FS/FS/Conf.pm | 19 | ||||
| -rw-r--r-- | FS/FS/Misc/Geo.pm | 58 | 
2 files changed, 36 insertions, 41 deletions
| diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 43521ce19..902c036d4 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 b727fa7e9..6bc71fc84 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$/;    { | 
