summaryrefslogtreecommitdiff
path: root/FS/FS/part_export.pm
diff options
context:
space:
mode:
authorlevinse <levinse>2011-07-01 06:54:03 +0000
committerlevinse <levinse>2011-07-01 06:54:03 +0000
commit4665d5af02f915679207a369222472a25e137c9d (patch)
treea86cb48ebf58eca185e4200ae5a89dc340e32429 /FS/FS/part_export.pm
parent4b80fe118da16b21603fcdbd090bc03d8fbf0578 (diff)
RADIUS group enhancements, overlimit_groups changes, etc. RT13432
Diffstat (limited to 'FS/FS/part_export.pm')
-rw-r--r--FS/FS/part_export.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index d3068df..890c522 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -431,6 +431,34 @@ sub export_info {
my $r = { map { %{$exports{$_}} } keys %exports };
}
+
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+
+ my @part_export_option = qsearch('part_export_option', { 'optionname' => 'overlimit_groups' });
+ foreach my $opt ( @part_export_option ) {
+ next if $opt->optionvalue =~ /^[\d\s]+$/ || !$opt->optionvalue;
+ my @groupnames = split(' ',$opt->optionvalue);
+ my @groupnums;
+ my $error = '';
+ foreach my $groupname ( @groupnames ) {
+ 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;
+ }
+ $opt->optionvalue(join(' ',@groupnums));
+ $error = $opt->replace;
+ die $error if $error;
+ }
+}
+
#=item exporttype2svcdb EXPORTTYPE
#
#Returns the applicable I<svcdb> for an I<exporttype>.