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') #;
16 || $FS::CurrentUser::CurrentUser->access_right('Post payment'): #remove after 1.7.3
18 $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
21 my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } )
22 or die "No such paynum";
24 my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } )
25 or die "Bogus credit: not attached to customer";
27 my $custnum = $cust_main->custnum;
30 if ($cgi->param('invnum') =~ /^Refund$/) {
31 $new = new FS::cust_refund ( {
32 'reason' => 'Refunding payment', #enter reason in UI
33 'refund' => $cgi->param('amount'),
35 #'_date' => $cgi->param('_date'),
36 'payinfo' => 'Cash', #enter payinfo in UI
40 $new = new FS::cust_bill_pay ( {
42 $_, scalar($cgi->param($_));
43 #} qw(custnum _date amount invnum)
44 } fields('cust_bill_pay')
48 my $error = $new->insert;