batch refactor continued
[freeside.git] / httemplate / misc / bill.cgi
1 %
2 %#untaint custnum
3 %my($query) = $cgi->keywords;
4 %$query =~ /^(\d*)$/;
5 %my $custnum = $1;
6 %my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
7 %die "Can't find customer!\n" unless $cust_main;
8 %
9 %my $conf = new FS::Conf;
10 %
11 %my $error = $cust_main->bill(
12 %#                          'time'=>$time
13 %                         );
14 %#&eidiot($error) if $error;
15 %
16 %unless ( $error ) {
17 %  $cust_main->apply_payments;
18 %  $cust_main->apply_credits;
19 %
20 %  $error = $cust_main->collect(
21 %  #                             'invoice-time'=>$time,
22 %                               #'batch_card'=> 'yes',
23 %                               #'batch_card'=> 'no',
24 %                               #'report_badcard'=> 'yes',
25 %                               #'retry_card' => 'yes',
26 %                               'retry' => 'yes',
27 %                               'realtime' => $conf->exists('realtime-backend'),
28 %                              );
29 %}
30 %#&eidiot($error) if $error;
31 %
32 %if ( $error ) {
33 %
34
35 <!-- mason kludge -->
36 %
37 %  &idiot($error);
38 %} else {
39 %  print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum");
40 %}
41 %
42