<%doc> Clickable link to bill a customer. Example: <% include( '/elements/bill.html', ### # required ### custnum => $custnum, label => 'Bill Now!', ### # recommended ### url => $p.'view/cust_main.cgi?'.$custnum, ### # optional, can contain any FS::cust_main::bill_and_collect options ### bill_opts => { 'batch_card' => 'yes' }, formname => 'MyBillNowLink', # if for some reason you want this ) %>
<% include('/elements/progress-init.html', $formname, [ 'custnum', @opt_keys ], $p.'misc/bill.cgi', \%args, $formname, # use it as 'key' ) %> <%$label%> % foreach(@opt_keys) { % }
<%init> my %opt = @_; my $custnum = $opt{'custnum'}; my $label = $opt{'label'}; # formname no longer needs to be passed from outside, but we still # need one and it needs to be unique my $formname = $opt{'formname'} || 'bill'.sprintf('%04d',random_id(4)).$custnum; my $bill_opts = $opt{'bill_opts'} || {}; my @opt_keys = keys(%$bill_opts); my @opt_vals = values(%$bill_opts); my %args = ( 'message' => $opt{'message'} || mt('Customer billed') ); $args{url} = $opt{url} if $opt{url};