RT# 83450 - fixed rateplan export
[freeside.git] / FS / FS / part_export / globalpops_voip.pm
index 52a4ec2..5eee13f 100644 (file)
@@ -5,6 +5,7 @@ use Tie::IxHash;
 use FS::Record qw(qsearch dbh);
 use FS::part_export;
 use FS::phone_avail;
+use Data::Dumper;
 
 @ISA = qw(FS::part_export);
 
@@ -19,6 +20,7 @@ tie my %options, 'Tie::IxHash',
   'svc'     => 'svc_phone',
   'desc'    => 'Provision phone numbers to VoIP Innovations (formerly GlobalPOPs VoIP)',
   'options' => \%options,
+  'no_machine' => 1,
   'notes'   => <<'END'
 Requires installation of
 <a href="http://search.cpan.org/dist/Net-GlobalPOPs-MediaServicesAPI">Net::GlobalPOPs::MediaServicesAPI</a>
@@ -28,6 +30,8 @@ END
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
@@ -73,8 +77,13 @@ sub get_dids {
   if ( $search->{'statuscode'} == 302200 ) {
     return [];
   } elsif ( $search->{'statuscode'} != 100 ) {
-    my $error = "Error running VoIP Innovations getDIDs: ".
-                 $search->{'statuscode'}. ': '. $search->{'status'}. "\n";
+
+    my $error = "Error running VoIP Innovations getDIDs: ";
+    if ( $search->{'statuscode'} || $search->{'status'} ) {
+      $error .= $search->{'statuscode'}. ': '. $search->{'status'}. "\n";
+    } else {
+      $error .= Dumper($search);
+    }
     warn $error;
     die $error;
   }
@@ -247,7 +256,7 @@ sub get_dids {
 sub gp_command {
   my( $self, $command, @args ) = @_;
 
-  eval "use Net::GlobalPOPs::MediaServicesAPI;";
+  eval "use Net::GlobalPOPs::MediaServicesAPI 0.03;";
   if ( $@ ) {
     warn $@;
     die $@;
@@ -359,7 +368,7 @@ sub _export_unsuspend {
 sub globalpops_voip_command {
   my($login, $password, $method, @args) = @_;
 
-  eval "use Net::GlobalPOPs::MediaServicesAPI;";
+  eval "use Net::GlobalPOPs::MediaServicesAPI 0.03;";
   die $@ if $@;
 
   my $gp = new Net::GlobalPOPs