2 % $cgi->param('error', $error );
3 <% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %>
5 <% header("One-time charge added") %>
6 <SCRIPT TYPE="text/javascript">
7 window.top.location.reload();
14 unless $FS::CurrentUser::CurrentUser->access_right('One-time charge');
17 my $param = $cgi->Vars;
20 for ( my $row = 0; exists($param->{"description$row"}); $row++ ) {
21 push @description, $param->{"description$row"}
22 if ($param->{"description$row"} =~ /\S/);
25 $param->{"custnum"} =~ /^(\d+)$/
26 or $error .= "Illegal customer number " . $param->{"custnum"} . " ";
29 $param->{"amount"} =~ /^\s*(\d+(\.\d{1,2})?)\s*$/
30 or $error .= "Illegal amount " . $param->{"amount"} . " ";
33 if ( $param->{'taxclass'} eq '(select)' ) {
34 $error .= "Must select a tax class. ";
38 my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } )
39 or $error .= "Unknown customer number $custnum. ";
41 $error ||= $cust_main->charge( {
43 'pkg' => scalar($cgi->param('pkg')),
44 'taxclass' => scalar($cgi->param('taxclass')),
45 'classnum' => scalar($cgi->param('classnum')),
46 'additional' => \@description,