diff options
Diffstat (limited to 'httemplate/edit/process/quick-charge.cgi')
-rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi new file mode 100644 index 000000000..477f58508 --- /dev/null +++ b/httemplate/edit/process/quick-charge.cgi @@ -0,0 +1,32 @@ +<% + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +my $custnum = $1; + +$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ + or die 'illegal amount '. $cgi->param('amount'); +my $amount = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +my $error = $cust_main->charge( + $amount, + $cgi->param('pkg'), + '$'. sprintf("%.2f",$amount), + $cgi->param('taxclass') +); + +if ($error) { +%> +<!-- mason kludge --> +<% + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); +} + +%> + |