X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_acct.cgi;h=d75ff92c15a1d9a49cfcee083a9b2ed79c6d5d2b;hb=c44432a5f0f1c1841ff8b50e734a30bd9aeef945;hp=41aca65ee94acc6ccda053bc940febb4c4154dca;hpb=36a1e9c1661fb552d368f2f675dcb0793d733748;p=freeside.git diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 41aca65ee..d75ff92c1 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -31,6 +31,11 @@ foreach (map { $_,$_."_threshold" } qw( upbytes downbytes totalbytes )) { $cgi->param($_, FS::UI::bytecount::parse_bytecount($cgi->param($_)) ); } +#for slipip, convert '(automatic)' to null +my $ip_addr = $cgi->param('slipip'); +$ip_addr =~ s/[^\d\.]//g; +$cgi->param('slipip', $ip_addr); + #unmunge cgp_accessmodes (falze laziness-ish w/part_svc.pm::process &svc_domain) unless ( $cgi->param('cgp_accessmodes') ) { $cgi->param('cgp_accessmodes', @@ -76,14 +81,19 @@ 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')); + my $newpass = $cgi->param('clear_password'); + if ( ! $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, @@ -92,6 +102,23 @@ if ( ! $error ) { grep { $_->machine eq '_SVC_MACHINE' } $part_svc->part_export; + if ( $part_svc->has_router ) { + my $router = FS::router->new({ + map { $_ => $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 ) @@ -105,9 +132,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; } }