diff options
author | levinse <levinse> | 2011-07-01 06:54:03 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-07-01 06:54:03 +0000 |
commit | 4665d5af02f915679207a369222472a25e137c9d (patch) | |
tree | a86cb48ebf58eca185e4200ae5a89dc340e32429 /FS/FS/Upgrade.pm | |
parent | 4b80fe118da16b21603fcdbd090bc03d8fbf0578 (diff) |
RADIUS group enhancements, overlimit_groups changes, etc. RT13432
Diffstat (limited to 'FS/FS/Upgrade.pm')
-rw-r--r-- | FS/FS/Upgrade.pm | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index ca6036e5f..3ea554e4a 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -6,7 +6,7 @@ use Exporter; use Tie::IxHash; use FS::UID qw( dbh driver_name ); use FS::Conf; -use FS::Record qw(qsearchs str2time_sql); +use FS::Record qw(qsearchs qsearch str2time_sql); use FS::svc_domain; $FS::svc_domain::whois_hack = 1; @@ -47,6 +47,35 @@ sub upgrade_config { if $conf->exists('payment_receipt_email') || $conf->config('payment_receipt_msgnum'); + upgrade_overlimit_groups($conf); + map { upgrade_overlimit_groups($conf,$_->agentnum) } qsearch('agent', {}); + +} + +sub upgrade_overlimit_groups { + my $conf = shift; + my $agentnum = shift; + my @groups = $conf->config('overlimit_groups',$agentnum); + if(scalar(@groups)) { + my $groups = join(',',@groups); + my @groupnums; + my $error = ''; + if ( $groups !~ /^[\d,]+$/ ) { + foreach my $groupname ( @groups ) { + my $g = qsearchs('radius_group', { 'groupname' => $groupname } ); + unless ( $g ) { + $g = new FS::radius_group { + 'groupname' => $groupname, + 'description' => $groupname, + }; + $error = $g->insert; + die $error if $error; + } + push @groupnums, $g->groupnum; + } + $conf->set('overlimit_groups',join("\n",@groupnums),$agentnum); + } + } } =item upgrade @@ -194,6 +223,7 @@ sub upgrade_data { # migrate to radius_group and groupnum instead of groupname 'radius_usergroup' => [], 'part_svc' => [], + 'part_export' => [], ; |