4 %my $svcnum = $cgi->param('svcnum');
5 %$svcnum =~ /^(\d+)$/ || die "Illegal svcnum";
9 %my $prepaid = $cgi->param('prepaid');
10 %$prepaid =~ /^(\w*)$/;
14 %my $svc_acct = qsearchs( 'svc_acct', {'svcnum'=>$svcnum} );
15 %$error = "Can't recharge service $svcnum. " unless $svc_acct;
17 %my $cust_main = $svc_acct->cust_svc->cust_pkg->cust_main;
19 %my $oldAutoCommit = $FS::UID::AutoCommit;
20 %local $FS::UID::AutoCommit = 0;
26 %my ($amount, $seconds, $up, $down, $total) = (0, 0, 0, 0, 0);
27 %$error = $cust_main->get_prepay($prepaid, \$amount, \$seconds, \$up, \$down, \$total)
28 % || $svc_acct->increment_seconds($seconds)
29 % || $svc_acct->increment_upbytes($up)
30 % || $svc_acct->increment_downbytes($down)
31 % || $svc_acct->increment_totalbytes($total)
32 % || $cust_main->insert_cust_pay_prepay( $amount, $prepaid );
36 % $cgi->param('error', $error);
37 % $dbh->rollback if $oldAutoCommit;
38 % print $cgi->redirect(popurl(2). "recharge_svc.html?". $cgi->query_string );
41 <% header("Package recharged") %>
42 <SCRIPT TYPE="text/javascript">
43 window.top.location.reload();