From df4a174a2156a642c25a3926fa1dba5e92263610 Mon Sep 17 00:00:00 2001 From: levinse Date: Wed, 29 Jun 2011 04:52:20 +0000 Subject: [PATCH] re-write RADIUS groups, RT13274 --- FS/FS/part_svc.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index d3fe3b6cc..dc7449a4f 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; } -- 2.11.0