[freeside-commits] freeside/bin wipe-customers,NONE,1.1
Ivan,,,
ivan at wavetail.420.am
Tue Aug 10 23:35:22 PDT 2010
Update of /home/cvs/cvsroot/freeside/bin
In directory wavetail.420.am:/tmp/cvs-serv6692/bin
Added Files:
wipe-customers
Log Message:
a better customer delete, RT#9564
--- NEW FILE: wipe-customers ---
#!/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;
}
More information about the freeside-commits
mailing list