4 use FS::UID qw(adminsuidsetup);
7 my $user = shift or die &usage;
10 #my $machine = shift or die &usage;
12 my @exports = qsearch('part_export', { 'exporttype' => 'sqlradius' } );
14 foreach my $export ( @exports ) {
15 my $icradius_dbh = DBI->connect(
16 map { $export->option($_) } qw( datasrc username password )
17 ) or die $DBI::errstr;
18 for my $table (qw( radcheck radreply usergroup )) {
19 my $sth = $icradius_dbh->prepare("DELETE FROM $table");
20 $sth->execute or die "Can't reset $table table: ". $sth->errstr;
24 foreach my $export ( @exports ) {
26 map { qsearchs{'svc_acct', { 'svcnum' => $_->svcnum } ) }
27 qsearch('cust_svc', { 'svcpart' => $export->part_svc->svcpart } );
28 foreach my $svc_acct ( @svc_acct ) {
30 #flase laziness with FS::svc_acct::insert (like it matters)
31 my $error = $part_export->export_insert($self);
33 $dbh->rollback if $oldAutoCommit;
34 return "exporting to ". $part_export->exporttype.
35 " (transaction rolled back): $error";
42 #die "Usage:\n\n icradius_reset user machine\n";
43 die "Usage:\n\n icradius_reset user\n";