diff options
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/part_export/internal_diddb.pm | 26 | 
1 files changed, 17 insertions, 9 deletions
| diff --git a/FS/FS/part_export/internal_diddb.pm b/FS/FS/part_export/internal_diddb.pm index d7b5587b1..aa04b773a 100644 --- a/FS/FS/part_export/internal_diddb.pm +++ b/FS/FS/part_export/internal_diddb.pm @@ -1,17 +1,22 @@  package FS::part_export::internal_diddb;  use vars qw(@ISA %info); -#use Tie::IxHash; +use Tie::IxHash;  use FS::Record qw(qsearch qsearchs);  use FS::part_export;  use FS::phone_avail;  @ISA = qw(FS::part_export); +tie my %options, 'Tie::IxHash', +  'countrycode' => { label => 'Country code', 'default' => '1', }, +; +  %info = ( -  'svc'   => 'svc_phone', -  '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)', +  'svc'     => 'svc_phone', +  '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,  );  sub rebless { shift; } @@ -20,7 +25,7 @@ sub get_dids {    my $self = shift;    my %opt = ref($_[0]) ? %{$_[0]} : @_; -  my %hash = ( 'countrycode' => 1, #XXX make an option or something +  my %hash = ( 'countrycode' => $self->option('countrycode'),                 'exportnum'   => $self->exportnum,                 'svcnum'      => '',               ); @@ -75,7 +80,7 @@ sub _export_insert   { #link phone_avail to svcnum    my( $npa, $nxx, $station ) = ($1, $2, $3);    my $phone_avail = qsearchs('phone_avail', { -    'countrycode' => 1, #XXX make an option or something +    'countrycode' => $self->option('countrycode'),      'exportnum'   => $self->exportnum,      'svcnum'      => '',      'npa'         => $npa, @@ -100,7 +105,7 @@ sub _export_delete   { #unlink phone_avail from svcnum    my( $npa, $nxx, $station ) = ($1, $2, $3);    my $phone_avail = qsearchs('phone_avail', { -    'countrycode' => 1, #XXX make an option or something +    'countrycode' => $self->option('countrycode'),      'exportnum'   => $self->exportnum,      'svcnum'      => $svc_phone->svcnum,      #these too? @@ -109,8 +114,11 @@ sub _export_delete   { #unlink phone_avail from svcnum      'station'     => $station,    }); -  return "can't find number to return to availability: ". $svc_phone->phonenum -    unless $phone_avail; +  unless ( $phone_avail ) { +    warn "WARNING: can't find number to return to availability: ". +         $svc_phone->phonenum; +    return; +  }    $phone_avail->svcnum(''); | 
