add -t flag to bulk void for payment type, RT#73413
[freeside.git] / bin / import-did-inventory
index 99c68bd..01fa2e8 100644 (file)
@@ -23,10 +23,10 @@ use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);
 print "started time=".time."\n";
 
 #### SET THESE! #################################
-my $file = '/home/levinse/dids1.csv';
+my $file = '/home/levinse/dids4.csv';
 my $did_vendor_id = 1; 
 my $dry = 0; 
-my $internal_diddb_exportnum = 2; # IMPORTANT: set this to the correct exportnum or everything will go in wrong into phone_avail
+my $internal_diddb_exportnum = 1; # IMPORTANT: set this to the correct exportnum or everything will go in wrong into phone_avail
 
 # optionally set this one (probably not)
 my %custname2num = (); # MyCust => 12345,
@@ -90,14 +90,16 @@ $latas{636} = 'BRAINERD-FARGO ND';
 $latas{920} = 'CONNECTICUT';
 $latas{334} = 'AUBURN-HUNTINGTON IN';
 $latas{232} = 'NORTHEAST - PA';
-$latas{460} = 'SOUTHEAST FL GG-EA';
+$latas{460} = 'SOUTHEAST FL GR-EA';
 $latas{952} = 'TAMPA FLORIDA';
 $latas{524} = 'KANSAS CITY';
 
 my $parser = new DateTime::Format::Natural( 'time_zone' => 'local' );
 sub parsedt {
     my ($dt,$min,$max) = (shift,shift,shift);
+    $dt = "$dt 00:00:00";
     my $epoch = $parser->parse_datetime($dt);
+    warn "dt='$dt' min=$min max=$max epoch=$epoch\n";
     return $epoch->epoch 
         if ($parser->success && $epoch->epoch >= $min && $epoch->epoch <= $max);
     fatal("invalid date $dt (min=$min, max=$max)");
@@ -179,7 +181,7 @@ sub suffer {
     $latadesc =~ s/\s\w+$// unless uc($ourdesc) eq uc($latadesc); # yeah...long story :(
 
     fatal("their LATA description '$latadesc' doesn't match our LATA description '$ourdesc'")
-        unless uc($ourdesc) eq uc($latadesc);
+        unless (uc($ourdesc) eq uc($latadesc) || $latanum == 460);
 
 
     ### MSA ###
@@ -356,11 +358,13 @@ sub order {
     my $o;
     if( exists $did_order{$vendor_order_id} ) {
         $o = $did_order{$vendor_order_id};
+#       warn "$submitted $confirmed $received $vendor_order_id".Dumper($o);
         fatal("vendor order #$vendor_order_id - order data differs from one item to another")
-            unless ( ($o->submitted == $submitted
+            unless ( ( abs($o->submitted-$submitted) < 5
                         || $o->vendor_order_id == 293011) # yet another bad data hack
-                    && $o->confirmed == $confirmed
-                    && $o->received == $received);
+                    && abs($o->confirmed-$confirmed) < 5
+                    && abs($o->received-$received) < 5 
+                   );
 #        fatal("customer mismatch for vendor order #$vendor_order_id")
 #           unless (    ($o->custnum && $cust{'custnum'} 
 #                        && ($o->custnum == $cust{'custnum'}