RT# 83450 - fixed rateplan export
[freeside.git] / FS / FS / part_export / internal_diddb.pm
index a94e43e..8771ae8 100644 (file)
@@ -17,10 +17,13 @@ tie my %options, 'Tie::IxHash',
   'desc'    => 'Provision phone numbers from the internal DID database',
   'notes'   => 'After adding the export, DIDs may be imported under Tools -> Importing -> Import phone numbers (DIDs)',
   'options' => \%options,
+  'no_machine' => 1,
 );
 
 sub rebless { shift; }
 
+sub can_get_dids { 1; }
+
 sub get_dids {
   my $self = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
@@ -78,7 +81,7 @@ sub get_dids {
                         })
            ];
 
-  } elsif ( $opt{'state'} ) { #return aracodes
+  } elsif ( $opt{'state'} ) { #return areacodes
 
     $hash{state} = $opt{state};
 
@@ -91,7 +94,15 @@ sub get_dids {
            ];
 
   } else { 
-    die "FS::part_export::internal_diddb::get_dids called without options\n";
+
+    #die "FS::part_export::internal_diddb::get_dids called without options\n";
+    return [ map { $_->npa. '-'. $_->nxx. '-'. $_->station }
+                 qsearch({ 'table'    => 'phone_avail',
+                           'hashref'  => \%hash,
+                           'order_by' => 'ORDER BY station',
+                        })
+           ];
+
   }
 
 }