summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-11-03 12:10:05 -0800
committerIvan Kohler <ivan@freeside.biz>2014-11-03 12:10:05 -0800
commit2a68fb7632bce93843dce65fcc581e7dbf840d67 (patch)
treedcd09eddc2ecb196accc471e4c22fd620948105b /bin
parentfaf400898c4fa9d784c83c54b8a27309caacd62a (diff)
reformat dates on aradial usage import, RT#29053
Diffstat (limited to 'bin')
-rwxr-xr-xbin/aradial-sftp_and_import7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/aradial-sftp_and_import b/bin/aradial-sftp_and_import
index 53357033c..668ec49ba 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;