summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/svc_acct_pop.cgi
blob: 6e823a82440dfac482ab1b51ea26ffad25388e0e (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
28
29
30
31
32
33
%if ( $error ) {
%  $cgi->param('error', $error);
<% $cgi->redirect(popurl(2). "svc_acct_pop.cgi?". $cgi->query_string ) %>
%} else {
<% $cgi->redirect(popurl(3). "browse/svc_acct_pop.cgi") %>
%}
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Dialup configuration')
      || $curuser->access_right('Dialup global configuration');

my $popnum = $cgi->param('popnum');

my $old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum;

my $new = new FS::svc_acct_pop ( {
  map {
    $_, scalar($cgi->param($_));
  } fields('svc_acct_pop')
} );

my $error = '';
if ( $popnum ) {
  $error = $new->replace($old);
} else {
  $error = $new->insert;
  $popnum=$new->getfield('popnum');
}

</%init>