add a useful debugging tool
[freeside.git] / httemplate / misc / unapply-cust_credit.cgi
1 <% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %>
2 <%init>
3
4 die "access denied"
5   unless $FS::CurrentUser::CurrentUser->access_right('Unapply credit');
6
7 #untaint crednum
8 my($query) = $cgi->keywords;
9 $query =~ /^(\d+)$/ || die "Illegal crednum";
10 my $crednum = $1;
11
12 my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
13 my $custnum = $cust_credit->custnum;
14
15 foreach my $cust_credit_bill ( $cust_credit->cust_credit_bill ) {
16   my $error = $cust_credit_bill->delete;
17   errorpage($error) if $error;
18 }
19
20 </%init>