prevent new "Bill now" link from futzing up later forms, RT#9193
[freeside.git] / httemplate / elements / bill.html
1 <%doc>
2
3 Clickable link to bill a customer.
4
5 Example:
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
25 </%doc>
26 <FORM STYLE="display:inline">
27 <% include('/elements/progress-init.html',
28           $formname,
29           [ 'custnum', @opt_keys ],
30           $p.'misc/bill.cgi',
31           $url ? { url => $url } : { message => $message },
32           $key,
33 ) %>
34 <A HREF="javascript:void(0);" onclick="javascript:<%$key%>process();"><%$label%></A>
35 <INPUT TYPE="hidden" NAME="custnum" VALUE="<%$custnum%>">
36 % foreach(@opt_keys) {
37 <INPUT TYPE="hidden" NAME="<%$_%>" VALUE="<%$bill_opts->{$_}%>">
38 % }
39 </FORM>
40 <%init>
41
42 my %opt = @_;
43 my $custnum   = $opt{'custnum'};
44 my $label     = $opt{'label'};
45 my $formname  = $opt{'formname'};
46 my $key       = $formname.'bill'.$custnum;
47 my $url       = $opt{'url'} || '';
48 my $message   = $opt{'message'} || 'Finished!';
49 my $bill_opts = $opt{'bill_opts'} || {};
50 my @opt_keys  = keys(%$bill_opts);
51 my @opt_vals  = values(%$bill_opts);
52
53 </%init>