projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 83122 Utility to issue credits against taxnums - fix typo
[freeside.git]
/
FS
/
bin
/
freeside-sqlradius-reset
diff --git
a/FS/bin/freeside-sqlradius-reset
b/FS/bin/freeside-sqlradius-reset
index
8ecd39d
..
225de15
100755
(executable)
--- a/
FS/bin/freeside-sqlradius-reset
+++ b/
FS/bin/freeside-sqlradius-reset
@@
-3,6
+3,7
@@
use strict;
use vars qw( $opt_n );
use Getopt::Std;
use strict;
use vars qw( $opt_n );
use Getopt::Std;
+use FS::DBI;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::part_export;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::part_export;
@@
-31,11
+32,14
@@
if ( @ARGV ) {
unless ( $opt_n ) {
foreach my $export ( @exports ) {
unless ( $opt_n ) {
foreach my $export ( @exports ) {
- my $icradius_dbh = DBI->connect(
+ my $icradius_dbh =
FS::
DBI->connect(
map { $export->option($_) } qw( datasrc username password )
map { $export->option($_) } qw( datasrc username password )
- ) or die $DBI::errstr;
+ ) or die $
FS::
DBI::errstr;
my $usergroup = $export->option('usergroup') || 'usergroup';
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;
}
my $sth = $icradius_dbh->prepare("DELETE FROM $table");
$sth->execute or die "Can't reset $table table: ". $sth->errstr;
}
@@
-47,6
+51,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;
$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;
foreach my $export ( @exports ) {
#my @svcparts = map { $_->svcpart } $export->export_svc;
@@
-85,6
+92,13
@@
foreach my $export ( @exports ) {
die $error if $error;
}
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 {
}
sub usage {