[freeside-commits] branch FREESIDE_3_BRANCH updated. a43929f7410683d0fbd411f36c84d063b7384fe6

Ivan ivan at 420.am
Mon Nov 3 12:10:09 PST 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  a43929f7410683d0fbd411f36c84d063b7384fe6 (commit)
      from  fabfdd343fd431ef431ebc4cbfa48f166d7bc386 (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 a43929f7410683d0fbd411f36c84d063b7384fe6
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Nov 3 12:10:07 2014 -0800

    reformat dates on aradial usage import, RT#29053

diff --git a/bin/aradial-sftp_and_import b/bin/aradial-sftp_and_import
index 5335703..668ec49 100755
--- a/bin/aradial-sftp_and_import
+++ b/bin/aradial-sftp_and_import
@@ -4,6 +4,7 @@
 
 use strict;
 use Getopt::Std;
+use Date::Parse;
 use Date::Format;
 use Text::CSV_XS;
 use DBI qw( :sql_types );
@@ -162,6 +163,8 @@ foreach my $filename ( @$ls ) {
     #skip blank records
     next unless grep defined($_), values %dbhash;
 
+    my $date = time2str( '%Y-%m-%d %X', str2time( $hash{'Date'} ) );
+
     $hash{'Status-Type'} = $status_type{ $hash{'Status-Type'} }
       if exists $status_type{ $hash{'Status-Type'} };
 
@@ -170,7 +173,7 @@ foreach my $filename ( @$ls ) {
     if ( $hash{'Status-Type'} eq 'Start' ) {
 
       push @keys, 'AcctStartTime';
-      $dbhash{'AcctStartTime'} = $hash{'Date'};
+      $dbhash{'AcctStartTime'} = $date;
 
       $sql = 'INSERT INTO radacct ( '. join(',', @keys).
              ' ) VALUES ( '. join(',', map ' ? ', @keys ). ' )';
@@ -180,7 +183,7 @@ foreach my $filename ( @$ls ) {
       my $AcctSessionId = delete($dbhash{AcctSessionId});
 
       push @keys, 'AcctStopTime';
-      $dbhash{'AcctStopTime'} = $hash{'Date'};
+      $dbhash{'AcctStopTime'} = $date;
 
       push @extra_values, $AcctSessionId;
 

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

Summary of changes:
 bin/aradial-sftp_and_import |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list