X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_acct.cgi;h=d4bcd35edd32efb83d18945f6a2392a2300c82f4;hb=87f255507af9f14dfbccd37eefd71a148f9af344;hp=a7d5136fb2cedecb2daa05438cc603832de3bafc;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index a7d5136fb..d4bcd35ed 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', @@ -56,13 +61,14 @@ my $new = new FS::svc_acct ( \%hash ); my $error = ''; +my $part_svc = $svcnum ? + $old->part_svc : + qsearchs( 'part_svc', + { 'svcpart' => $cgi->param('svcpart') } + ); + # google captcha auth if ( $cgi->param('captcha_response') ) { - my $part_svc = $svcnum ? - $old->part_svc : - qsearchs( 'part_svc', - { 'svcpart' => $cgi->param('svcpart') } - ); my ($export) = $part_svc->part_export('acct_google'); if ( $export and ! $export->captcha_auth($cgi->param('captcha_response')) ) { @@ -79,6 +85,18 @@ if ( $cgi->param('clear_password') eq '*HIDDEN*' } if ( ! $error ) { + + my $export_info = FS::part_export::export_info(); + + my @svc_export_machine = + map FS::svc_export_machine->new({ + 'svcnum' => $svcnum, + 'exportnum' => $_->exportnum, + 'machinenum' => scalar($cgi->param('exportnum'.$_->exportnum.'machinenum')), + }), + grep { $_->machine eq '_SVC_MACHINE' } + $part_svc->part_export; + if ( $svcnum ) { foreach ( grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes ) @@ -92,9 +110,9 @@ if ( ! $error ) { $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } - $error ||= $new->replace($old); + $error ||= $new->replace($old, 'child_objects'=>\@svc_export_machine); } else { - $error ||= $new->insert; + $error ||= $new->insert('child_objects'=>\@svc_export_machine); $svcnum = $new->svcnum; } }