[freeside-commits] branch FREESIDE_3_BRANCH updated. cff1496af12df71e2fd35775cb72d8e8bf2560f8

Mark Wells mark at 420.am
Thu Jul 17 14:16:41 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  cff1496af12df71e2fd35775cb72d8e8bf2560f8 (commit)
      from  7e9c8df93590ae1319539626c540c97b9199beb0 (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 cff1496af12df71e2fd35775cb72d8e8bf2560f8
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Jul 17 14:16:26 2014 -0700

    Northern 911 export: include first/last name or company name, #29195

diff --git a/FS/FS/part_export/northern_911.pm b/FS/FS/part_export/northern_911.pm
index 27f150c..027a52d 100644
--- a/FS/FS/part_export/northern_911.pm
+++ b/FS/FS/part_export/northern_911.pm
@@ -52,6 +52,7 @@ sub export_insert {
 
   my %location_hash = $svc_phone->location_hash;
   $location_hash{address1} =~ /^(\w+) +(.*)$/;
+
   my %customer = (
     'PHONE_NUMBER'        => $svc_phone->phonenum,
     'STREET_NUMBER'       => $1,
@@ -61,6 +62,31 @@ sub export_insert {
     'POSTAL_CODE_ZIP'     => $location_hash{zip},
     'OTHER_ADDRESS_INFO'  => $location_hash{address2},
   );
+  my $phone_name = $svc_phone->phone_name;
+  if ( $phone_name ) {
+    # could be a personal name or a business...
+    if ( $svc_phone->e911_class and
+        grep { $_ eq $svc_phone->e911_class }
+         ( 2, 4, 5, 6, 7, 0, 'A', 'D', 'E', 'K')
+       )
+    {
+      # one of the "Business" classes, Centrex, a payphone, or 
+      # VoIP Enterprise class
+      $customer{'LAST_NAME'} = $phone_name;
+    } else {
+      # assume residential, and try (inaccurately) to make a first/last
+      # name out of it.
+      @customer{'FIRST_NAME', 'LAST_NAME'} = split(' ', $phone_name, 2);
+    }
+  } else {
+    my $cust_main = $svc_phone->cust_svc->cust_pkg->cust_main;
+    if ($cust_main->company) {
+      $customer{'LAST_NAME'} = $cust_main->company;
+    } else {
+      $customer{'LAST_NAME'} = $cust_main->last;
+      $customer{'FIRST_NAME'} = $cust_main->first;
+    }
+  }
 
   if ($self->option('debug')) {
     warn "\nAddorUpdateCustomer:\n".Dumper(\%customer)."\n\n";

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

Summary of changes:
 FS/FS/part_export/northern_911.pm |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)




More information about the freeside-commits mailing list