2 <& /elements/header-popup.html, mt("Payment voided") &>
3 <SCRIPT TYPE="text/javascript">
4 window.top.location.reload();
9 <& /elements/header-popup.html, mt('Void payment') &>
11 <& /elements/error.html &>
13 <P ALIGN="center"><B><% mt('Void this payment?') |h %></B>
14 % if ( $cust_pay->payby =~ /^(CARD|CHEK)$/ ) {
15 <P ALIGN="center"><% mt('(Do not send anything to the payment gateway)') |h %>
18 <FORM action="<% ${p} %>misc/void-cust_pay.html">
19 <INPUT TYPE="hidden" NAME="paynum" VALUE="<% $paynum %>">
21 <TABLE BGCOLOR="#cccccc" BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto">
22 <& /elements/tr-select-reason.html,
23 'field' => 'reasonnum',
24 'reason_class' => 'P',
31 <INPUT TYPE="submit" NAME="confirm_void_payment" VALUE="<% mt('Void payment') |h %>">
32
33 <INPUT TYPE="BUTTON" VALUE="<% mt("Don't void payment") |h %>" onClick="parent.cClick();">
43 my $paynum = $cgi->param('paynum');
45 $paynum =~ /^(\d+)$/ || die "Illegal paynum";
47 my($query) = $cgi->keywords;
48 $query =~ /^(\d+)/ || die "Illegal paynum";
52 my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}) || die "Payment not found";
54 my $right = 'Void payments';
55 $right = 'Credit card void' if $cust_pay->payby eq 'CARD';
56 $right = 'Echeck void' if $cust_pay->payby eq 'CHEK';
59 unless $FS::CurrentUser::CurrentUser->access_right($right);
62 if ($cgi->param('confirm_void_payment')) {
64 #untaint reasonnum / create new reason
65 my ($reasonnum, $error) = $m->comp('process/elements/reason');
67 $error = 'Reason required';
69 my $reason = qsearchs('reason', { 'reasonnum' => $reasonnum })
70 || die "Reason num $reasonnum not found in database";
71 $error = $cust_pay->void($reason) unless $error;
75 $cgi->param('error',$error);