diff options
author | levinse <levinse> | 2011-06-29 04:52:20 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-29 04:52:20 +0000 |
commit | df4a174a2156a642c25a3926fa1dba5e92263610 (patch) | |
tree | d85cf79d152e574b7559d4eebfa6fbf8cc9e43ea /FS/FS/part_svc.pm | |
parent | f3066cbe669a488a7842a1219b2cddf8690f2c32 (diff) |
re-write RADIUS groups, RT13274
Diffstat (limited to 'FS/FS/part_svc.pm')
-rw-r--r-- | FS/FS/part_svc.pm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index d3fe3b6..dc7449a 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -875,13 +875,21 @@ sub _upgrade_data { #class method next if $col->columnvalue =~ /^[\d,]+$/ || !$col->columnvalue; my @groupnames = split(',',$col->columnvalue); my @groupnums; + my $error = ''; foreach my $groupname ( @groupnames ) { - my $g = qsearchs('radius_group', { 'groupname' => $groupname } ) - || die "invalid group ".$groupname; + 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; } $col->columnvalue(join(',',@groupnums)); - my $error = $col->replace; + $error = $col->replace; die $error if $error; } |