X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_acct.cgi;h=0d2c007f1f475b938148d15195f17b42b3ff226c;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=0a89e253c652e6bf86276c3eecde044dd3bb6496;hpb=c648976f0b7975f2328ebd7ba8c711fad0ca4195;p=freeside.git diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 0a89e253c..0d2c007f1 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -5,7 +5,7 @@ <% $cgi->redirect(popurl(3). "view/svc_acct.cgi?" . $svcnum ) %> %} <%init> - +use CGI::Carp; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? @@ -23,12 +23,6 @@ if ( $svcnum ) { #unmunge popnum $cgi->param('popnum', (split(/:/, $cgi->param('popnum') ))[0] ); -#unmunge passwd -if ( $cgi->param('_password') eq '*HIDDEN*' ) { - die "fatal: no previous account to recall hidden password from!" unless $old; - $cgi->param('_password',$old->getfield('_password')); -} - #unmunge usergroup $cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); @@ -37,6 +31,18 @@ foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) { $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) ); } +#unmunge cgp_accessmodes (falze laziness-ish w/part_svc.pm::process &svc_domain) +unless ( $cgi->param('cgp_accessmodes') ) { + $cgi->param('cgp_accessmodes', + join(' ', + sort map { /^cgp_accessmodes_([\w\/]+)$/ or die "no way"; $1; } + grep $cgi->param($_), + grep /^cgp_accessmodes_([\w\/]+)$/, + $cgi->param() + ) + ); +} + my %hash = $svcnum ? $old->hash : (); map { $hash{$_} = scalar($cgi->param($_)); @@ -45,19 +51,31 @@ map { } (fields('svc_acct'), qw ( pkgnum svcpart usergroup )); my $new = new FS::svc_acct ( \%hash ); -my $error; +my $error = ''; + +$new->_password($old->_password) if $old; +if ( $cgi->param('clear_password') eq '*HIDDEN*' + || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { + die "fatal: no previous account to recall hidden password from!" unless $old; +} else { + $error = $new->set_password($cgi->param('clear_password')); +} + if ( $svcnum ) { - foreach (grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes )) { + foreach ( grep { $old->$_ != $new->$_ } + qw( seconds upbytes downbytes totalbytes ) + ) + { my %hash = map { $_ => $new->$_ } grep { $new->$_ } qw( seconds upbytes downbytes totalbytes ); - $error = $new->set_usage(\%hash); #unoverlimit and trigger radius changes - last; #once is enough + $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes + last; #once is enough } $error ||= $new->replace($old); } else { - $error = $new->insert; + $error ||= $new->insert; $svcnum = $new->svcnum; }