diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-09 21:42:09 -0600 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-03-09 21:42:09 -0600 |
commit | 48098d73a72b6cc4d4242ac66d497bf5a4466b7a (patch) | |
tree | ccbe770e7fc3b490510d0b1719b330f86a3b58a6 /FS/bin | |
parent | 7028a82d5c0f499ab582f7c452a759945fb915d0 (diff) |
RT#40056: Export DID's to portaone switch [improvements]
Diffstat (limited to 'FS/bin')
-rw-r--r-- | FS/bin/freeside-cdr-portaone-import | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/FS/bin/freeside-cdr-portaone-import b/FS/bin/freeside-cdr-portaone-import index e2023c8aa..dfd130bbb 100644 --- a/FS/bin/freeside-cdr-portaone-import +++ b/FS/bin/freeside-cdr-portaone-import @@ -16,12 +16,14 @@ use FS::cdr_batch; sub usage { "Usage: +freeside-cdr-portaone-import -x exportnum [-s startdate] [-e enddate] [-v] freesideuser + freeside-cdr-portaone-import -h 'your.domain.com:443' -u switchusername -p switchpass [-s startdate] [-e enddate] [-v] freesideuser "; } -my ($host,$username,$password,$startdate,$enddate,$verbose); +my ($host,$username,$password,$startdate,$enddate,$verbose,$exportnum); GetOptions( "enddate=s" => \$enddate, "host=s" => \$host, @@ -29,11 +31,12 @@ GetOptions( "startdate=s" => \$startdate, "username=s" => \$username, "verbose" => \$verbose, + "x=s" => \$exportnum, ); my $fsuser = $ARGV[-1]; -die usage() unless $host && $password && $username && $fsuser; +die usage() unless $fsuser; adminsuidsetup($fsuser); @@ -43,6 +46,19 @@ if ($host =~ /^(.*)\:(.*)$/) { $port = $2; } +if ($exportnum) { + my $export = qsearchs('part_export', { 'exportnum' => $exportnum }); + die "Export not found" unless $export; + $host = $export->machine; + $port = $export->option('port'); + $username = $export->option('username'); + $password = $export->option('password'); + die "Auth info not fully specified in export" + unless $host && $port && $username && $password; +} + +die usage() unless $host && $password && $username; + if ($startdate) { $startdate = str2time($startdate) or die "Can't parse startdate $startdate"; $startdate = time2str("%Y-%m-%d %H:%M:%S",$startdate); |