add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / Record.pm
index 18198d8..7f76d99 100644 (file)
@@ -199,6 +199,7 @@ sub new {
 
   $self->{'modified'} = 0;
 
+  $self->_simplecache($self->{'Hash'})  if $self->can('_simplecache');
   $self->_cache($self->{'Hash'}, shift) if $self->can('_cache') && @_;
 
   $self;
@@ -1077,7 +1078,7 @@ sub get_fk_method {
 }
 
 sub fk_methods_init {
-  warn "[fk_methods_init]\n";
+  warn "[fk_methods_init]\n" if $DEBUG;
   foreach my $table ( dbdef->tables ) {
     $fk_method_cache{$table} = fk_methods($table);
   }
@@ -2151,6 +2152,7 @@ sub batch_import {
   #my $job     = $param->{job};
   my $line;
   my $imported = 0;
+  my $unique_skip = 0; #lines skipped because they're already in the system
   my( $last, $min_sec ) = ( time, 5 ); #progressbar foo
   while (1) {
 
@@ -2253,6 +2255,7 @@ sub batch_import {
       }
       last if exists( $param->{skiprow} );
     }
+    $unique_skip++ if $param->{unique_skip}; #line is already in the system
     next if exists( $param->{skiprow} );
 
     if ( $preinsert_callback ) {
@@ -2298,7 +2301,8 @@ sub batch_import {
 
   unless ( $imported || $param->{empty_ok} ) {
     $dbh->rollback if $oldAutoCommit;
-    return "Empty file!";
+    # freeside-cdr-conexiant-import is sensitive to the text of this message
+    return $unique_skip ? "All records in file were previously imported" : "Empty file!";
   }
 
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;