summaryrefslogtreecommitdiff
path: root/bin/wipe-customers
diff options
context:
space:
mode:
authorcvs2git <cvs2git>2010-11-05 19:05:57 +0000
committercvs2git <cvs2git>2010-11-05 19:05:57 +0000
commitaaf8baf3662e16e9414de236a39f8801a8c41b01 (patch)
tree2cda603e4311b3e80f79b93d9bcce3a7c7c2d053 /bin/wipe-customers
parent995a145c931164347683071c95c6754379d36604 (diff)
parent9b2de4257b6a2877434008188e52b8ef71ff339d (diff)
This commit was manufactured by cvs2svn to create branch
'FREESIDE_2_1_BRANCH'.
Diffstat (limited to 'bin/wipe-customers')
-rw-r--r--bin/wipe-customers30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/wipe-customers b/bin/wipe-customers
new file mode 100644
index 000000000..e65ed61be
--- /dev/null
+++ b/bin/wipe-customers
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::cust_main;
+
+die "this removes all customers in your database except for customer 1 - remove this line to enable";
+
+my $user = shift or die "usage: wipe-customers username\n";
+adminsuidsetup $user;
+
+#this isn't terribly efficient, but the idea was clearing out a test database,
+#not actually destroying a large amount of data
+
+foreach my $cust_main (
+
+ qsearch('cust_main', { 'custnum' => { op=>'!=', value=>'1' } } )
+
+) {
+
+ my @cerrors = $cust_main->cancel( quiet=>1, nobill=>1 );
+ if ( @cerrors ) {
+ die join(' / ', @cerrors);
+ }
+
+ my $error = $cust_main->delete( 'delete_financials' => 1);
+ die $error if $error;
+
+}