X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Faradial-sftp_and_import;h=b0878e277825f9882f9a93502e20f5ccaa79a299;hp=cc2238e1f4b520615c219dee37b1106fb10230a2;hb=d979d53c0a6fdec99bfd3bf9c6b246b14c101507;hpb=e2ef13ff1681fef43744037fa0c89e04253f054b

diff --git a/bin/aradial-sftp_and_import b/bin/aradial-sftp_and_import
index cc2238e1f..b0878e277 100755
--- a/bin/aradial-sftp_and_import
+++ b/bin/aradial-sftp_and_import
@@ -157,6 +157,9 @@ foreach my $filename ( @$ls ) {
 
     my @keys = keys %dbhash;
 
+    #skip blank records
+    next unless grep defined($_), values %dbhash;
+
     $hash{'Status-Type'} = $status_type{ $hash{'Status-Type'} }
       if exists $status_type{ $hash{'Status-Type'} };
 
@@ -166,8 +169,8 @@ foreach my $filename ( @$ls ) {
 
       $dbhash{'AcctStartTime'} = $hash{'Date'};
 
-      $sql = 'INSERT INTO radacct ( ', join(',', @keys).
-             ' ) VALUES ( '. map( ' ? ', @keys ). ' )';
+      $sql = 'INSERT INTO radacct ( '. join(',', @keys).
+             ' ) VALUES ( '. join(',', map ' ? ', @keys ). ' )';
 
     } elsif ( $hash{'Status-Type'} eq 'Stop' ) {
 
@@ -194,6 +197,7 @@ foreach my $filename ( @$ls ) {
     foreach my $value ( map $dbhash{$_}, @keys ) {
       my $key = shift @keys;
       my $type = exists($bind_type{$key}) ? $bind_type{$key} : SQL_VARCHAR;
+      $value ||= 0 if $type == SQL_INTEGER;
       $sth->bind_param($p_num++, $value, $type);
     }
     foreach my $value ( @extra_values ) {