tie %options, 'Tie::IxHash', (
'company_name' => { label => 'Company name for header record',
- type => 'text'
+ type => 'text',
},
'company_id' => { label => 'NENA company ID',
type => 'text',
},
+ 'customer_code' => { label => 'Customer code',
+ type => 'text',
+ },
+ 'area_code' => { label => 'Default area code for 7 digit numbers',
+ type => 'text',
+ },
'prefix' => { label => 'File name prefix',
type => 'text',
},
my $cust_location = FS::cust_location->by_key($locationnum);
# initialize with empty strings
- my %hash = map { $_ => '' } $item_format->names;
+ my %hash = map { $_ => '' } @{ $item_format->names };
$hash{function_code} = $function_code{$action};
- # phone number
+ # Add default area code if phonenum is 7 digits
+ if ($self->option('area_code') =~ /^\d{3}$/ && $svc->phonenum =~ /^\d{7}$/ ){
+ $svc->phonenum = $self->option('area_code'). $svc->phonenum;
+ }
+
+ # phone number
+
$svc->phonenum =~ /^(\d{3})(\d*)$/;
$hash{npa} = $1;
$hash{calling_number} = $2;
# so we can't comply. NENA 3 fixed this...
$hash{company_id} = $self->option('company_id');
+ $hash{customer_code} = $self->option('customer_code') || '';
$hash{source_id} = $initial_load_hack ? 'C' : ' ';
- @hash{'zip', 'zip_'} = split('-', $cust_location->zip);
-
- # $hash{customer_code} is supposed to "uniquely identify a customer" but
- # they give us 3 alphanumeric characters. Not sure how that works.
-
+ @hash{'zip_code', 'zip_4'} = split('-', $cust_location->zip);
+
$hash{x_coordinate} = $cust_location->longitude;
$hash{y_coordinate} = $cust_location->latitude;
# $hash{z_coordinate} = $cust_location->altitude; # not implemented, sadly
# ignore items that have no data to add to the batch
next if $item->action eq 'suspend' or $item->action eq 'unsuspend';
- my $svcnum = $item->svcnum;
my $data = $item->data;
%hash = %{ $item_format->parse($data) };
my $phonenum = $hash{npa} . $hash{calling_number};