2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %>
5 <% header('Payment application sucessful') %>
6 <SCRIPT TYPE="text/javascript">
7 window.top.location.reload();
15 unless $FS::CurrentUser::CurrentUser->access_right('Apply payment');
17 $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
20 my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } )
21 or die "No such paynum";
23 my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } )
24 or die "Bogus credit: not attached to customer";
26 my $custnum = $cust_main->custnum;
29 if ($cgi->param('invnum') =~ /^Refund$/) {
30 $new = new FS::cust_refund ( {
31 'reason' => 'Refunding payment', #enter reason in UI
32 'refund' => $cgi->param('amount'),
34 #'_date' => $cgi->param('_date'),
35 'payinfo' => 'Cash', #enter payinfo in UI
39 $new = new FS::cust_bill_pay ( {
41 $_, scalar($cgi->param($_));
42 #} qw(custnum _date amount invnum)
43 } fields('cust_bill_pay')
47 my $error = $new->insert;