RT# 83450 - fixed rateplan export
[freeside.git] / FS / FS / part_export / pbxware.pm
index 4373e7a..e535e6e 100644 (file)
@@ -17,10 +17,11 @@ our $DEBUG = 0;
 # our $DEBUG = 2; # log requests and content of replies
 
 tie my %options, 'Tie::IxHash',
-  'apikey'  => { label => 'API key' },
-  'debug'   => { label => 'Enable debugging', type => 'checkbox', value => 1 },
-  'ext'     => { label => 'PBXware "ext" field in CDR download request', },
-  'cdrtype' => { label => 'PBXware "cdrtype" field in CDR download request', },
+  'apikey'   => { label => 'API key' },
+  'debug'    => { label => 'Enable debugging', type => 'checkbox', value => 1 },
+  'ext'      => { label => 'PBXware "ext" field in CDR download request', },
+  'cdrtype'  => { label => 'PBXware "cdrtype" field in CDR download request', },
+  'trunkdst' => { label => 'PBXware "trunkdst" field in CDR download request', },
 ;
 
 our %info = (
@@ -100,7 +101,7 @@ sub import_cdrs {
   );
 
   $opt{$_} = $self->option($_)
-    for grep length( $self->option($_) ), qw( ext cdrtype );
+    for grep length( $self->option($_) ), qw( ext cdrtype trunkdst );
 
   # unlike Certain Other VoIP providers, this one does proper pagination if
   # the result set is too big to fit in a single chunk.
@@ -137,7 +138,7 @@ sub import_cdrs {
       # page's IDs or something.
       my $uniqueid = md5_hex(join(',',@$row));
       if ( FS::cdr->row_exists('uniqueid = ?', $uniqueid) ) {
-        warn "skipped duplicate row in page $page\n" if $DEBUG > 1;
+        warn "skipped duplicate row in page $page\n" if $DEBUG;
         next CDR;
       }
 
@@ -186,7 +187,7 @@ local $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;
     ]
   );
   warn "$me $method\n" if $DEBUG;
-  warn $request->as_string."\n" if $DEBUG > 1;
+  warn $request->as_string."\n" if $DEBUG;
 
   my $ua = LWP::UserAgent->new;
   my $response = $ua->request($request);