fix DBI binding for negative integers, shoudl fix CCH update, RT#14243
[freeside.git] / FS / FS / Record.pm
index 1280f08..ad26d60 100644 (file)
@@ -265,7 +265,7 @@ sub _bind_type {
 
   my $bind_type = { TYPE => SQL_VARCHAR };
 
-  if ( $type =~ /(big)?(int|serial)/i && $value =~ /^\d+(\.\d+)?$/ ) {
+  if ( $type =~ /(big)?(int|serial)/i && $value =~ /^-?\d+(\.\d+)?$/ ) {
 
     $bind_type = { TYPE => SQL_INTEGER };
 
@@ -1850,10 +1850,12 @@ sub batch_import {
       next if $line =~ /^\s*$/; #skip empty lines
 
       $line = &{$row_callback}($line) if $row_callback;
+      
+      next if $line =~ /^\s*$/; #skip empty lines
 
       $parser->parse($line) or do {
         $dbh->rollback if $oldAutoCommit;
-        return "can't parse: ". $parser->error_input();
+        return "can't parse: ". $parser->error_input() . " " . $parser->error_diag;
       };
       @columns = $parser->fields();
 
@@ -1922,7 +1924,7 @@ sub batch_import {
     next if exists( $param->{skiprow} );
 
     if ( $preinsert_callback ) {
-      my $error = &{$postinsert_callback}($record, $param);
+      my $error = &{$preinsert_callback}($record, $param);
       if ( $error ) {
         $dbh->rollback if $oldAutoCommit;
         return "preinsert_callback error". ( $line ? " for $line" : '' ).