From 6f0d2394d35b47761f54991895cdf40c4e6bcc16 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 1 Mar 2011 04:38:31 +0000 Subject: [PATCH] VoipNow export, minor fixes --- FS/FS/part_export/voipnow_did.pm | 8 ++++++-- bin/populate-areacodes | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/FS/FS/part_export/voipnow_did.pm b/FS/FS/part_export/voipnow_did.pm index cd13a44d5..514db8dcd 100644 --- a/FS/FS/part_export/voipnow_did.pm +++ b/FS/FS/part_export/voipnow_did.pm @@ -5,7 +5,6 @@ use Tie::IxHash; use FS::Record qw(qsearch qsearchs dbh); use FS::part_export; use FS::areacode; -use XML::Writer; use XML::Simple 'XMLin'; use Net::SSLeay 'post_https'; use Cache::FileCache; @@ -19,6 +18,7 @@ tie my %options, 'Tie::IxHash', 'login' => { label=>'VoipNow client login' }, 'password' => { label=>'VoipNow client password' }, 'country' => { label=>'Country (two-letter code)' }, + 'cache_time' => { label=>'Cache lifetime (seconds)' }, ; %info = ( @@ -38,7 +38,8 @@ sub did_cache { my $self = shift; $CACHE ||= new Cache::FileCache( { 'namespace' => __PACKAGE__, - 'default_expires_in' => 300, + 'default_expires_in' => $self->option('cache_time') || 300, + 'cache_root' => $FS::UID::cache_dir.'/cache'.$FS::UID::datasrc, } ); return $CACHE->get($self->exportnum) || $self->reload_cache; } @@ -259,6 +260,9 @@ sub voipnow_command { my $host = $self->machine; my $path = "/soap2/${endpoint}_agent.php"; + eval "use XML::Writer"; + die $@ if $@; + warn "[$method] constructing request\n" if $DEBUG; my $soap_request; my $writer = XML::Writer->new( diff --git a/bin/populate-areacodes b/bin/populate-areacodes index f5e8ae105..7e4c52fdc 100644 --- a/bin/populate-areacodes +++ b/bin/populate-areacodes @@ -40,7 +40,7 @@ while(<$fh>) { } my $areacode = FS::areacode->new({ - 'npa' => $npa, + 'code' => $npa, 'state' => $statecode, 'country' => $countrycode, 'description' => $desc, -- 2.11.0