blob: e65ed61be3d356fea06c05fd01e353ea6bcc6138 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
}
|