X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fb-move-customers;h=e98ac62b835e6d6682dc6dc1d0a0014b5b46826d;hp=d6124479618fceeb9e3fcaeafcc480b221388766;hb=51c0d6572357ba4d7c11a11e7ff506428c1cc045;hpb=5d1c873c38990030fc082294ff728518460ccead diff --git a/bin/b-move-customers b/bin/b-move-customers index d61244796..e98ac62b8 100755 --- a/bin/b-move-customers +++ b/bin/b-move-customers @@ -5,7 +5,7 @@ use strict; use vars qw( $sdbh ); -use DBI; +use FS::DBI; use FS::UID qw( adminsuidsetup dbh ); use FS::Schema qw( dbdef ); use FS::Record qw( qsearchs ); @@ -20,18 +20,12 @@ use FS::svc_domain; use FS::cust_pkg; my $DANGEROUS = 0; -my $DRY = 1; +my $DRY = 0; -# XXX: use SSL for real version -my $source_datasrc = ''; -my $source_user = ''; -my $source_pw = ''; +my $source_datasrc = 'dbi:Pg:dbname=benson'; -#### MANUAL #### -# 1. Destination agent must be created with correct agentnum -# 2. Destination refnum must be created as per below -# 3. System domain must be created appropriately -##### +my $source_user = 'freeside'; +my $source_pw = ''; my $dest_agentnum = 3; my $src_agentnum = 1; @@ -41,14 +35,13 @@ my %domsvc_map = ( 2 => 10375, ); -# XXX my %eventparts = ( - # 'CARD' => [ 1, ], - # 'CHEK' => [ 2, ], - # 'BILL' => [ 5, ], - # 'DCHK' => [ 12, ], - # 'DCRD' => [ 15, ], - # 'COMP' => [], + 'CARD' => [ 13, 14, 15 ], + 'CHEK' => [], + 'BILL' => [ 13, ], + 'DCHK' => [], + 'DCRD' => [ 13, ], + 'COMP' => [], ); #-- @@ -79,8 +72,8 @@ my $void_paynum = 2147483646; #top of int range # source(remote) setup -$sdbh = DBI->connect($source_datasrc, $source_user, $source_pw) - or die $DBI::errstr; +$sdbh = FS::DBI->connect($source_datasrc, $source_user, $source_pw) + or die $FS::DBI::errstr; $sdbh->{ChopBlanks} = 1; @@ -208,6 +201,9 @@ while ( my $customerrow = $customer_sth->fetchrow_hashref ) { import_table( 'cust_pkg', 'custnum' => $src_custnum, 'preinsert_callback' => sub { my($row, $object) = @_; + + $object->start_date(''); #bogus start dates on all packages + my $src_pkgpart = $row->{'pkgpart'} or die "wtf"; my $dest_pkgpart = $map{'part_pkg'}->{$src_pkgpart}; if ( $dest_pkgpart ) {