2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). "svc_acct.cgi?". $cgi->query_string ) %>
5 <% $cgi->redirect(popurl(3). "view/svc_acct.cgi?" . $svcnum ) %>
10 unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
12 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
17 $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } )
18 or die "fatal: can't find account (svcnum $svcnum)!";
24 $cgi->param('popnum', (split(/:/, $cgi->param('popnum') ))[0] );
27 if ( $cgi->param('_password') eq '*HIDDEN*' ) {
28 die "fatal: no previous account to recall hidden password from!" unless $old;
29 $cgi->param('_password',$old->getfield('_password'));
33 $cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] );
36 foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) {
37 $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) );
40 my %hash = $svcnum ? $old->hash : ();
42 $hash{$_} = scalar($cgi->param($_));
43 #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir
45 } (fields('svc_acct'), qw ( pkgnum svcpart usergroup ));
46 my $new = new FS::svc_acct ( \%hash );
50 foreach (grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes )) {
51 my %hash = map { $_ => $new->$_ }
53 qw( seconds upbytes downbytes totalbytes );
55 $error = $new->set_usage(\%hash); #unoverlimit and trigger radius changes
58 $error ||= $new->replace($old);
60 $error = $new->insert;
61 $svcnum = $new->svcnum;