2 <& /elements/header-popup.html, mt("Credit voided") &>
3 <SCRIPT TYPE="text/javascript">
4 window.top.location.reload();
9 <& /elements/header-popup.html, mt('Void credit') &>
11 <& /elements/error.html &>
13 <P ALIGN="center"><B><% mt('Void this credit?') |h %></B>
15 <FORM action="<% ${p} %>misc/void-cust_credit.html">
16 <INPUT TYPE="hidden" NAME="crednum" VALUE="<% $crednum %>">
18 <TABLE BGCOLOR="#cccccc" BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto">
19 <& /elements/tr-select-reason.html,
20 'field' => 'reasonnum',
21 'reason_class' => 'X',
28 <INPUT TYPE="submit" NAME="confirm_void_credit" VALUE="<% mt('Void credit') |h %>">
29
30 <INPUT TYPE="BUTTON" VALUE="<% mt("Don't void credit") |h %>" onClick="parent.cClick();">
40 unless $FS::CurrentUser::CurrentUser->access_right('Void credit');
43 my $crednum = $cgi->param('crednum');
45 $crednum =~ /^(\d+)$/ || die "Illegal crednum";
47 my($query) = $cgi->keywords;
48 $query =~ /^(\d+)/ || die "Illegal crednum";
52 my $cust_credit = qsearchs('cust_credit',{'crednum'=>$crednum}) || die "Credit not found";
55 if ($cgi->param('confirm_void_credit')) {
57 #untaint reasonnum / create new reason
58 my ($reasonnum, $error) = $m->comp('process/elements/reason');
60 $error = 'Reason required';
62 my $reason = qsearchs('reason', { 'reasonnum' => $reasonnum })
63 || die "Reason num $reasonnum not found in database";
64 $error = $cust_credit->void($reason) unless $error;
68 $cgi->param('error',$error);