summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/radius_group.html
blob: 884694618796ad22ff06825595c11febaf4880af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<& elements/process.html,
  'table'       => 'radius_group',
  'viewall_dir' => 'browse',
  'process_o2m' => {
    'table'   => 'radius_attr',
    'fields'  => [ qw( attrtype attrname op value )],
  },
  'precheck_callback' => $precheck_callback,
&>
<%init>
die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $precheck_callback = sub {
  my $cgi = shift;
  my $param = $cgi->Vars;
  # remove rows with a blank attrname and attrnum
  foreach my $k (grep /^attrnum\d+$/, keys %$param) {
    if ( !length($param->{$k}) and !length($param->{$k.'_attrname'}) ) {
      delete $param->{$k.'_'.$_} foreach qw(attrtype attrname op value);
      delete $param->{$k};
    }
  }
  '';
};

</%init>