Have lineitem-specific applications happen in all cases; add weightsto control
[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_and_credits;
18 %
19 %  $error = $cust_main->collect(
20 %  #                             'invoice-time'=>$time,
21 %                               #'batch_card'=> 'yes',
22 %                               #'batch_card'=> 'no',
23 %                               #'report_badcard'=> 'yes',
24 %                               #'retry_card' => 'yes',
25 %                               'retry' => 'yes',
26 %                               'realtime' => $conf->exists('realtime-backend'),
27 %                              );
28 %}
29 %#&eidiot($error) if $error;
30 %
31 %if ( $error ) {
32 %
33
34 <!-- mason kludge -->
35 %
36 %  &idiot($error);
37 %} else {
38 %  print $cgi->redirect(popurl(2). "view/cust_main.cgi?$custnum");
39 %}
40 %
41