X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Fimport-did-inventory;h=99c68bdac5fd7f59a181150886dd727b2e3fb61a;hb=e1768291d6475a8e42c04e2a28037a422cbac042;hp=03108f7f487dd54f9e8cbeed1ad6518bbe84b38e;hpb=b017568f0d15d6756de1c04da19530462749469b;p=freeside.git diff --git a/bin/import-did-inventory b/bin/import-did-inventory index 03108f7f4..99c68bdac 100644 --- a/bin/import-did-inventory +++ b/bin/import-did-inventory @@ -18,22 +18,23 @@ use FS::phone_avail; use FS::did_vendor; use FS::svc_phone; use Data::Dumper; +use Time::HiRes qw(usleep ualarm gettimeofday tv_interval); print "started time=".time."\n"; #### SET THESE! ################################# my $file = '/home/levinse/dids1.csv'; my $did_vendor_id = 1; -my $dry = 1; -my $debug = 0; +my $dry = 0; my $internal_diddb_exportnum = 2; # 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, ################################################ my $user = shift; adminsuidsetup $user; -# oh yeah this is fun when you can't Ctrl+C me local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; local $SIG{QUIT} = 'IGNORE'; @@ -66,14 +67,16 @@ my %msamap = ( 'Miami' => 33100, 'Jackson' => 27140, 'St Cloud' => 41060, + 'Stratford' => 14860, # more hax upon hax (the above are unique, no issues) 'Portland OR' => 38900, 'Portland ME' => 38860, ); my $skipto = 0; -my $limit = 900; +my $limit = 0; my $linenum = 1; +my $debug = 0; # cache LATA and MSA tables in one query for performance my @latas = qsearch('lata', {}); @@ -87,7 +90,7 @@ $latas{636} = 'BRAINERD-FARGO ND'; $latas{920} = 'CONNECTICUT'; $latas{334} = 'AUBURN-HUNTINGTON IN'; $latas{232} = 'NORTHEAST - PA'; -$latas{460} = 'SOUTHEAST FL GR-EA'; +$latas{460} = 'SOUTHEAST FL GG-EA'; $latas{952} = 'TAMPA FLORIDA'; $latas{524} = 'KANSAS CITY'; @@ -358,10 +361,14 @@ sub order { || $o->vendor_order_id == 293011) # yet another bad data hack && $o->confirmed == $confirmed && $o->received == $received); - fatal("customer mismatch for vendor order #$vendor_order_id") - unless ( ($o->custnum && $cust{'custnum'} - && $o->custnum == $cust{'custnum'}) - || (!$o->custnum && !exists($cust{'custnum'})) ); +# fatal("customer mismatch for vendor order #$vendor_order_id") +# unless ( ($o->custnum && $cust{'custnum'} +# && ($o->custnum == $cust{'custnum'} +# || $vendor_order_id eq '293745' || $vendor_order_id eq '300001') +# ) +# || +# (!$o->custnum && !exists($cust{'custnum'})) +# ); } else { $o = new FS::did_order{ vendornum => $did_vendor_id, vendor_order_id => $vendor_order_id, @@ -394,18 +401,17 @@ sub provision { phonenum => $did, }); - # XXX: THIS LINE CAUSES PERFORMANCE TO DEGRADE AND THE SCRIPT NEVER FINISHES! WHY!? + # XXX: THIS LINE CAUSES PERFORMANCE TO DEGRADE # -unattaching the exports has no effect # -after each successive call, the time taken to complete 100 rows becomes greater # -commenting out this call results in a constant time taken to complete 100 rows - # -after 10K rows we get a random error that makes no sense my $error = $svc_phone->insert; fatal("can't insert svc_phone: $error") if $error; - #$phone_avail->svcnum($svc_phone->svcnum); - #$error = $phone_avail->replace; - #fatal("can't replace phone_avail: $error") if $error; + $phone_avail->svcnum($svc_phone->svcnum); + $error = $phone_avail->replace; + fatal("can't replace phone_avail: $error") if $error; ''; }