X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-sqlradius-reset;h=b04c640d842c1b5306258f36153d5f12acdc373a;hb=0668c6afdce579dd202b12874bc0e9f1abe40ada;hp=8ecd39d9578f33f76f19adef0d6d98205b1ef581;hpb=addc359b0c1b1771d6ccc3de372f3a584e677c94;p=freeside.git diff --git a/FS/bin/freeside-sqlradius-reset b/FS/bin/freeside-sqlradius-reset index 8ecd39d95..b04c640d8 100755 --- a/FS/bin/freeside-sqlradius-reset +++ b/FS/bin/freeside-sqlradius-reset @@ -35,7 +35,10 @@ unless ( $opt_n ) { map { $export->option($_) } qw( datasrc username password ) ) or die $DBI::errstr; my $usergroup = $export->option('usergroup') || 'usergroup'; - for my $table (qw( radcheck radreply ), $usergroup) { + my @attr_tables; + @attr_tables = qw( radgroupcheck radgroupreply ) + if $export->option('export_attrs'); + for my $table (qw( radcheck radreply ), $usergroup, @attr_tables) { my $sth = $icradius_dbh->prepare("DELETE FROM $table"); $sth->execute or die "Can't reset $table table: ". $sth->errstr; } @@ -47,6 +50,9 @@ use FS::svc_Common; $FS::svc_Common::overlimit_missing_cust_svc_nonfatal_kludge = 1; $FS::svc_Common::overlimit_missing_cust_svc_nonfatal_kludge = 1; +# this is the same across all exports, for now +my @radius_attrs = qsearch('radius_attr', {}); + foreach my $export ( @exports ) { #my @svcparts = map { $_->svcpart } $export->export_svc; @@ -85,6 +91,13 @@ foreach my $export ( @exports ) { die $error if $error; } + + if ( $export->option('export_attrs') ) { + foreach my $attr (@radius_attrs) { + my $error = $export->export_attr_insert($attr); + die $error if $error; + } + } } sub usage {