"Bill now" link uses job queue/progressbar, RT#8995
[freeside.git] / httemplate / elements / bill.html
1 <%doc>
2 Clickable link to bill a customer.
3
4 Example:
5 <FORM name="MyForm">
6 <% include( '/elements/bill.html',
7             ###
8             # required
9             ###
10             custnum   => $custnum,
11             label     => 'Bill Now!',
12             formname  => 'MyForm',
13
14             ###
15             # recommended
16             ###
17             url       => $p.'view/cust_main.cgi?'.$custnum,
18
19             ###
20             # optional, can contain any FS::cust_main::bill_and_collect options
21             ###
22             bill_opts => { 'batch_card' => 'yes' },
23 ) %>
24 </FORM>
25 </%doc>
26 <% include('/elements/progress-init.html',
27           $formname,
28           [ 'custnum', @opt_keys ],
29           $p.'misc/bill.cgi',
30           $url ? { url => $url } : { message => $message },
31           $key,
32 ) %>
33 <A HREF="javascript:void(0);" onclick="javascript:<%$key%>process();"><%$label%></A>
34 <INPUT TYPE="hidden" NAME="custnum" VALUE="<%$custnum%>">
35 % foreach(@opt_keys) {
36 <INPUT TYPE="hidden" NAME="<%$_%>" VALUE="<%$bill_opts->{$_}%>">
37 % }
38 <%init>
39 my %opt = @_;
40 my $custnum   = $opt{'custnum'};
41 my $label     = $opt{'label'};
42 my $formname  = $opt{'formname'};
43 my $key       = $formname.'bill'.$custnum;
44 my $url       = $opt{'url'} || '';
45 my $message   = $opt{'message'} || 'Finished!';
46 my $bill_opts = $opt{'bill_opts'} || {};
47 my @opt_keys  = keys(%$bill_opts);
48 my @opt_vals  = values(%$bill_opts);
49 </%init>