X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fvitelity.pm;h=29ed8b6a1f312ba58b9ffe6ea2ea702e62cdf961;hb=00cd6dc7e1f767476d449a9180d44e6a6d042284;hp=8d802b16d7390e20d4f399dedc97053ca4f907aa;hpb=7dd7870cac67454c84c1dc3b3003a64a61b3451f;p=freeside.git diff --git a/FS/FS/part_export/vitelity.pm b/FS/FS/part_export/vitelity.pm index 8d802b16d..29ed8b6a1 100644 --- a/FS/FS/part_export/vitelity.pm +++ b/FS/FS/part_export/vitelity.pm @@ -4,7 +4,7 @@ use base qw( FS::part_export ); use vars qw( %info ); use Tie::IxHash; use Geo::StreetAddress::US; -use Net::Vitelity; +use Net::Vitelity 0.05; use FS::Record qw( qsearch dbh ); use FS::phone_avail; use FS::svc_phone; @@ -25,6 +25,10 @@ tie my %options, 'Tie::IxHash', 'disable_e911' => { label => "Disable E911 provisioning", type => 'checkbox', }, + 'debug' => { label => 'Enable debugging', + type => 'checkbox', + value => 1, + }, ; %info = ( @@ -246,10 +250,10 @@ sub vitelity_command { my( $self, $command, @args ) = @_; my $vitelity = Net::Vitelity->new( - 'login' => $self->option('login'), - 'pass' => $self->option('pass'), - 'apitype' => $self->option('fax') ? 'fax' : 'api', - #'debug' => $debug, + 'login' => $self->option('login'), + 'pass' => $self->option('pass'), + 'apitype' => $self->option('fax') ? 'fax' : 'api', + 'debug' => $self->option('debug'), ); $vitelity->$command(@args); @@ -259,10 +263,10 @@ sub vitelity_lnp_command { my( $self, $command, @args ) = @_; my $vitelity = Net::Vitelity->new( - 'login' => $self->option('login'), - 'pass' => $self->option('pass'), - 'apitype' => 'lnp', - #'debug' => $debug, + 'login' => $self->option('login'), + 'pass' => $self->option('pass'), + 'apitype' => 'lnp', + 'debug' => $self->option('debug'), ); $vitelity->$command(@args); @@ -278,6 +282,20 @@ sub _export_insert { #porting a number in? different code path if ( $svc_phone->lnp_status eq 'portingin' ) { + my $cust_main = $svc_phone->cust_svc->cust_pkg->cust_main; + + return 'Customer company is required' + unless $cust_main->company; + + return 'Customer day phone (for contact, not porting) is required' + unless $cust_main->daytime; + + return 'LNP Other Provider is required' + unless $svc_phone->lnp_other_provider; + + return 'LNP Other Provider Account # is required' + unless $svc_phone->lnp_other_provider_account; + my %location = $svc_phone->location_hash; my $sa = Geo::StreetAddress::US->parse_location( $location{'address1'} ); @@ -286,7 +304,7 @@ sub _export_insert { 'partial' => 'no', 'wireless' => 'no', 'carrier' => $svc_phone->lnp_other_provider, - 'company' => $svc_phone->cust_svc->cust_pkg->cust_main->company, + 'company' => $cust_main->company, 'accnumber' => $svc_phone->lnp_other_provider_account, 'name' => $svc_phone->phone_name_or_cust, 'streetnumber' => $sa->{number}, @@ -301,7 +319,7 @@ sub _export_insert { 'state' => $location{'state'}, 'zip' => $location{'zip'}, 'billnumber' => $svc_phone->phonenum, #?? do we need a new field for this? - 'contactnumber' => $svc_phone->cust_svc->cust_pkg->cust_main->daytime, + 'contactnumber' => $cust_main->daytime, ); if ( $result =~ /^ok:/i ) {