summaryrefslogtreecommitdiff
path: root/httemplate/misc/unapply-cust_credit.cgi
blob: aa1a3a9c20d799f7aed46e7a4e49da831ce682a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Unapply credit');

#untaint crednum
my($query) = $cgi->keywords;
$query =~ /^(\d+)$/ || die "Illegal crednum";
my $crednum = $1;

my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
my $custnum = $cust_credit->custnum;

foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) {
  my $error = $cust_credit_bill->delete;
  errorpage($error) if $error;
}

</%init>