[freeside-commits] freeside/bin move-customers,1.2,1.3
Ivan,,,
ivan at wavetail.420.am
Mon Aug 24 00:08:13 PDT 2009
Update of /home/cvs/cvsroot/freeside/bin
In directory wavetail.420.am:/tmp/cvs-serv5425/bin
Modified Files:
move-customers
Log Message:
(start of) customer move script, RT#5351
Index: move-customers
===================================================================
RCS file: /home/cvs/cvsroot/freeside/bin/move-customers,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- move-customers 24 Aug 2009 06:50:00 -0000 1.2
+++ move-customers 24 Aug 2009 07:08:11 -0000 1.3
@@ -17,6 +17,7 @@
use FS::cust_bill_ApplicationCommon;
my $DANGEROUS = 1;
+my $DRY = 1;
#ssh -p 2222 -L 1080:66.209.32.4:7219 -L 5454:localhost:5432 66.209.32.4
@@ -46,6 +47,8 @@
$sdbh = DBI->connect($source_datasrc, $source_user, $source_pw)
or die $DBI::errstr;
+$sdbh->{ChopBlanks} = 1;
+
import_table('pkg_class', 'nomap' => 1);
my $agent_sth = $sdbh->prepare(
@@ -145,8 +148,8 @@
'agent_custid' => $src_custnum,
};
- $cust_main->ship_country('') if $cust_main->ship_country eq ' ';
- $cust_main->tax('') if $cust_main->tax =~ /^\s+$/;
+ #$cust_main->ship_country('') if $cust_main->ship_country eq ' ';
+ #$cust_main->tax('') if $cust_main->tax =~ /^\s+$/;
my $error = $cust_main->insert;
if ( $error ) {
@@ -248,6 +251,10 @@
if $src_classnum;
my $part_pkg = new FS::part_pkg $hashref;
+
+ #$part_pkg->setuptax('') if $part_pkg->setuptax =~ /^\s+$/;
+ #$part_pkg->recurtax('') if $part_pkg->recurtax =~ /^\s+$/;
+
my $error = $part_pkg->insert( 'options' => {} );
die "*** FATAL: error importing part_pkg src pkgpart $src_pkgpart ".
": $error"
@@ -434,6 +441,18 @@
}
+
+warn "import successful!\n"
+if ( $DRY ) {
+ warn "rolling back (dry run)\n";
+ dbh->rollback or die dbh->errstr;
+ warn "rolled back\n"
+} else {
+ warn "commiting\n";
+ dbh->commit or die dbh->errstr;
+ warn "committed\n";
+}
+
sub import_table {
my( $table, %opt ) = @_;
More information about the freeside-commits
mailing list