[freeside-commits] branch FREESIDE_3_BRANCH updated. 6677ad47acaa5a66c32c3038259565da10a6ae6f

Christopher Burger burgerc at freeside.biz
Thu Jan 25 12:28:17 PST 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  6677ad47acaa5a66c32c3038259565da10a6ae6f (commit)
       via  957a034a7ff934c997c394ace34d4ecb0baeba4f (commit)
      from  4ac4e6000f4bbdc3482ef3a0432ddab954581f0e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6677ad47acaa5a66c32c3038259565da10a6ae6f
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Jan 25 12:27:36 2018 -0500

    RT# 79121 - fixed error with loading files with option a

diff --git a/FS/bin/freeside-cdr-aninetworks-import b/FS/bin/freeside-cdr-aninetworks-import
index a8fc0cbfd..b5fc226a4 100755
--- a/FS/bin/freeside-cdr-aninetworks-import
+++ b/FS/bin/freeside-cdr-aninetworks-import
@@ -61,8 +61,8 @@ if ( $opt_a ) {
   if ($most_recent) {
     if ($most_recent->cdrbatch =~ /^*Daily_(\d+)_/) {
       my $date = $1;
-      warn "limiting to dates > $date (from most recent batch)\n" if $opt_v;
-      @files = grep { /^*Daily_(\d+)_/ && $1 > $date } @files;
+      warn "limiting to dates >= $date (from most recent batch)\n" if $opt_v;
+      @files = grep { /^*Daily_(\d+)_/ && $1 >= $date } @files;
     }
   }
 }

commit 957a034a7ff934c997c394ace34d4ecb0baeba4f
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Jan 25 12:06:08 2018 -0500

    RT#79121 - added POD documentation

diff --git a/FS/bin/freeside-cdr-aninetworks-import b/FS/bin/freeside-cdr-aninetworks-import
index 1e6217648..a8fc0cbfd 100755
--- a/FS/bin/freeside-cdr-aninetworks-import
+++ b/FS/bin/freeside-cdr-aninetworks-import
@@ -55,30 +55,34 @@ my $ls = $sftp->ls('.', wanted => qr/^UYM.*.zip$/i, names_only =>1 );
 my @files = @$ls;
 
 warn scalar(@files)." CDR files found.\n" if $opt_v;
-# apply date range
+# apply date range from last downloaded batch.
 if ( $opt_a ) {
   my $most_recent = $previous[0];
   if ($most_recent) {
-    if ($most_recent->cdrbatch =~ /^ani_networks-(\d+)/) {
+    if ($most_recent->cdrbatch =~ /^*Daily_(\d+)_/) {
       my $date = $1;
       warn "limiting to dates > $date (from most recent batch)\n" if $opt_v;
       @files = grep { /^*Daily_(\d+)_/ && $1 > $date } @files;
     }
-  } # else download them all
+  }
 }
+
+# apply a start date if given
 if ( $opt_s ) {
-  # start date
   # normalize date format
   $opt_s = time2str('%Y%m%d', str2time($opt_s)) if $opt_s =~ /\D/;
   warn "limiting to dates > $opt_s\n" if $opt_v;
   @files= grep { /^*Daily_(\d+)_/ && $1 >= $opt_s } @files;
 }
+
+# apply a end date if given
 if ( $opt_e ) {
-  # end date
+  # normalize date format
   $opt_e = time2str('%Y%m%d', str2time($opt_e)) if $opt_e =~ /\D/;
   warn "limiting to dates < $opt_e\n" if $opt_v;
   @files= grep { /^*Daily_(\d+)_/ && $1 < $opt_e } @files;
 }
+
 warn scalar(@files) ." files to be downloaded\n" if $opt_v;
 foreach my $file (@files) {
 
@@ -164,3 +168,55 @@ sub sftp {
   $sftp;
 }
 
+=head1 NAME
+
+freeside-cdr-aninetworks-import - Download CDR files from a remote server via SFTP
+
+=head1 SYNOPSIS
+
+  freeside-cdr-aninetworks-import [ -v ] [ -d ] [ -a ] [ -c cdrtypenum ]
+    [ -s startdate ] [ -e enddate ] user sftpuser sftppassword
+
+=head1 DESCRIPTION
+
+Command line tool to download CDR files from a remote server via SFTP
+and then import them into the database.
+
+-v: be verbose
+
+-d: enable sftp debugging (very noisy)
+
+-a: automatically choose start date from most recently downloaded batch
+
+-c: cdrtypenum to set, defaults to none
+
+-s: if specified, sets a startdate. startdate starts at 00:00:00
+
+-e: if specified, sets a enddate. enddate starts at 00:00:00 so if you wish to include enddate must add one more day.
+
+user: freeside username
+
+sftpuser: sftp user for arkftp.aninetworks.com
+
+sftppassword: password for sftp user
+
+=head1 EXAMPLES
+
+freeside-cdr-aninetworks-import -a <freeside user> <sftp login> <sftp password>
+will get all cdr files starting from the day of the last day processed.
+
+freeside-cdr-aninetworks-import -s 20180120 -e 20180121 <freeside user> <sftp login> <sftp password>
+will get all cdr files from 01/20/2018
+
+freeside-cdr-aninetworks-import -v -s $(date --date="-1 day" +\%Y\%m\%d) -e $(date +\%Y\%m\%d) <freeside user> <sftp login> <sftp password>
+will get all cdr files from yesterday
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::cdr>
+
+=cut
+
+1;
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 FS/bin/freeside-cdr-aninetworks-import | 70 ++++++++++++++++++++++++++++++----
 1 file changed, 63 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list