3 use FS::UID 'adminsuidsetup';
4 use FS::Record qw( qsearch qsearchs );
8 my ($user, $exportnum, $group) = @ARGV;
10 sqlradius-reexport-group <username> <exportnum> <group>
11 " unless $user and $exportnum and $group;
14 my $dbh = adminsuidsetup($user) or die;
15 $FS::UID::AutoCommit = 0;
17 if ( $group =~ /^\d+$/ ) {
18 $radius_group = FS::radius_group->by_key($group);
20 $radius_group = qsearchs('radius_group',{'groupname' => $group});
22 die "no radius group $group" unless $radius_group;
24 my $export = FS::part_export->by_key($exportnum)
25 or die "no export with exportnum '$exportnum'";
27 my @attrs = qsearch('radius_attr', {groupnum => $radius_group->groupnum});
28 foreach my $attr (@attrs) {
29 print $attr->attrname."\n";
30 my $error = $export->export_attr_insert($attr);