X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_acct.cgi;h=12e84cc47f8682cea524a1a1342df1d8c0b396c2;hb=38f5c59a6a3b92881c0f60bc8dccc9acd0feef41;hp=d4bcd35edd32efb83d18945f6a2392a2300c82f4;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;p=freeside.git diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index d4bcd35ed..12e84cc47 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -64,7 +64,7 @@ my $error = ''; my $part_svc = $svcnum ? $old->part_svc : qsearchs( 'part_svc', - { 'svcpart' => $cgi->param('svcpart') } + { 'svcpart' => scalar($cgi->param('svcpart')) } ); # google captcha auth @@ -76,19 +76,37 @@ if ( $cgi->param('captcha_response') ) { } } -$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; +# check whether the password is set as "fixed" in the service def. if so, +# ignore the password that was submitted and use the fixed value. + +my $psc = $part_svc->part_svc_column('_password'); +if ( $psc->columnflag eq 'F' ) { + + $new->set('_password', $psc->columnvalue); + } else { - $error ||= $new->set_password($cgi->param('clear_password')); + + $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 { + my $newpass = $cgi->param('clear_password'); + if ( !$old or ! $old->check_password($newpass) ) { + # then the password is being changed + $error ||= $new->is_password_allowed($newpass) + || $new->set_password($newpass); + } + } + } if ( ! $error ) { my $export_info = FS::part_export::export_info(); - my @svc_export_machine = + my @child_objects = map FS::svc_export_machine->new({ 'svcnum' => $svcnum, 'exportnum' => $_->exportnum, @@ -97,6 +115,23 @@ if ( ! $error ) { grep { $_->machine eq '_SVC_MACHINE' } $part_svc->part_export; + if ( $part_svc->has_router ) { + my $router = FS::router->new({ + map { $_ => scalar($cgi->param("router_$_")) } + qw( routernum routername blocknum ) + }); + if (length($router->routername) == 0) { + #sensible default + $router->set('routername', $new->label); + } + if (length($router->blocknum) == 0) { + #unset it + $router->set('blocknum', 0); + } + push @child_objects, $router; + } + + if ( $svcnum ) { foreach ( grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes ) @@ -110,9 +145,9 @@ if ( ! $error ) { $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } - $error ||= $new->replace($old, 'child_objects'=>\@svc_export_machine); + $error ||= $new->replace($old, 'child_objects'=>\@child_objects); } else { - $error ||= $new->insert('child_objects'=>\@svc_export_machine); + $error ||= $new->insert('child_objects'=>\@child_objects); $svcnum = $new->svcnum; } }