these errors are fatal for now, and fix them, RT#83146, RT#40206
[freeside.git] / FS / bin / freeside-cdr-asterisk_sql
index a5a570d..cd765de 100755 (executable)
@@ -130,10 +130,12 @@ while ( my $row = $sth->fetchrow_hashref ) {
 
   $cdr->cdrbatchnum($cdrbatchnum);
 
+  $cdr->amaflags('') unless $cdr->amaflags =~ /^(\d+)$/;
+
   if ( my $error = $cdr->insert ) {
-    log_msg( error =>
-      sprintf 'Non-fatal failure to import acctid(%s) from table(%s): %s',
-        $row->acctid,
+    log_and_die( error =>
+      sprintf 'Fatal failure to import uniqueid(%s) from table(%s): %s',
+        $row->{'uniqueid'},
         $table,
         $error
     );
@@ -149,7 +151,7 @@ while ( my $row = $sth->fetchrow_hashref ) {
         @args = ( undef );
       } else {
         $usql .= ' uniqueid = ?';
-        @args = ( $row->{'uniqueid'} );
+        @args = ( undef, $row->{'uniqueid'} );
       }
     } else {
       $usql .= ' calldate = ? AND src = ? AND dst = ?';
@@ -159,9 +161,9 @@ while ( my $row = $sth->fetchrow_hashref ) {
     if ( $dbi->do($usql, @args) ) {
       $updates++;
     } else {
-      log_msg( error =>
-        sprintf 'Non-fatal failure set status(done) acctid(%s) table(%s): %s',
-          $row->acctid,
+      log_and_die( error =>
+        sprintf 'Fatal failure set status(done) uniqueid(%s) table(%s): %s',
+          $row->{'uniqueid'},
           $table,
           $dbi->errstr
       );