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 $cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] );
30 foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) {
31 $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) );
34 #unmunge cgp_accessmodes (falze laziness-ish w/part_svc.pm::process &svc_domain)
35 unless ( $cgi->param('cgp_accessmodes') ) {
36 $cgi->param('cgp_accessmodes',
38 sort map { /^cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; }
40 grep /^cgp_accessmodes_([\w\/]+)$/,
46 my %hash = $svcnum ? $old->hash : ();
47 for ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) {
48 $hash{$_} = scalar($cgi->param($_));
51 for ( grep $old->$_, qw( cf_privatekey ) ) {
55 my $new = new FS::svc_acct ( \%hash );
60 if ( $cgi->param('captcha_response') ) {
61 my $part_svc = $svcnum ?
64 { 'svcpart' => $cgi->param('svcpart') }
66 my ($export) = $part_svc->part_export('acct_google');
68 ! $export->captcha_auth($cgi->param('captcha_response')) ) {
69 $error = 'Re-enter the security word.';
73 $new->_password($old->_password) if $old;
74 if ( $cgi->param('clear_password') eq '*HIDDEN*'
75 || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) {
76 die "fatal: no previous account to recall hidden password from!" unless $old;
78 $error ||= $new->set_password($cgi->param('clear_password'));
83 foreach ( grep { $old->$_ != $new->$_ }
84 qw( seconds upbytes downbytes totalbytes )
87 my %hash = map { $_ => $new->$_ }
89 qw( seconds upbytes downbytes totalbytes );
91 $error ||= "invalid $_" foreach grep { $hash{$_} !~ /^-?\d+$/ } keys %hash;
92 $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes
95 $error ||= $new->replace($old);
97 $error ||= $new->insert;
98 $svcnum = $new->svcnum;