X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fvitelity.pm;h=089e1093da52f72316571acf695d606505142da2;hb=884d54765a4709bee112d7204b127670648b7a55;hp=0b6b81b27940cb65738aaa7619f5e1deb25e936f;hpb=110e4ab13ff3b0d7df2265a68e92170c59d76e61;p=freeside.git
diff --git a/FS/FS/part_export/vitelity.pm b/FS/FS/part_export/vitelity.pm
index 0b6b81b27..089e1093d 100644
--- a/FS/FS/part_export/vitelity.pm
+++ b/FS/FS/part_export/vitelity.pm
@@ -4,6 +4,7 @@ use base qw( FS::part_export );
use vars qw( %info );
use Tie::IxHash;
use Geo::StreetAddress::US;
+use Net::Vitelity 0.05;
use FS::Record qw( qsearch dbh );
use FS::phone_avail;
use FS::svc_phone;
@@ -24,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 = (
@@ -32,10 +37,6 @@ tie my %options, 'Tie::IxHash',
'options' => \%options,
'no_machine' => 1,
'notes' => <<'END'
-Requires installation of
-Net::Vitelity
-from CPAN.
-
routesip - optional Vitelity sub-account to which newly ordered DIDs will be routed
type - optional DID type (perminute, unlimited, or your-pri)
END
@@ -60,7 +61,7 @@ sub get_dids {
return [] if ( $tollfree[0] eq 'noneavailable' || $tollfree[0] eq 'none');
foreach my $did ( @tollfree ) {
- $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable did $did\n";
+ $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable toll-free did $did\n";
push @ret, $did;
}
@@ -100,7 +101,7 @@ sub get_dids {
die "missingdata error running Vitelity API" if $dids[0] eq 'missingdata';
foreach my $did ( @dids ) {
- $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable did $did\n";
+ $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable (state and ratecenter) did $did\n";
my($npa, $nxx, $station) = ($1, $2, $3);
my $phone_avail = new FS::phone_avail {
@@ -210,7 +211,7 @@ sub get_dids {
}
foreach my $did ( @dids ) {
- $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable did $did\n";
+ $did =~ /^(\d{3})(\d{3})(\d{4})/ or die "unparsable (state) did $did\n";
my($npa, $nxx, $station) = ($1, $2, $3);
$npa{$npa}++;
@@ -248,14 +249,11 @@ sub get_dids {
sub vitelity_command {
my( $self, $command, @args ) = @_;
- eval "use Net::Vitelity;";
- die $@ if $@;
-
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);
@@ -264,14 +262,11 @@ sub vitelity_command {
sub vitelity_lnp_command {
my( $self, $command, @args ) = @_;
- eval "use Net::Vitelity 0.04;";
- die $@ if $@;
-
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);
@@ -474,10 +469,14 @@ sub _export_unsuspend {
sub check_lnp {
my $self = shift;
- my $in_svcpart = 'IN ('. join( ',', map $_->svcpart, $self->export_svc). ')';
+ my @export_svc = $self->export_svc;
+ return unless @export_svc;
+
+ my $in_svcpart = 'IN ('. join( ',', map $_->svcpart, @export_svc). ')';
foreach my $svc_phone (
qsearch({ 'table' => 'svc_phone',
+ 'addl_from' => 'LEFT JOIN cust_svc USING (svcnum)',
'hashref' => {lnp_status=>'portingin'},
'extra_sql' => "AND svcpart $in_svcpart",
})