X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-payment_options.html;h=27df9622ecf794bfd6d074b8d32cd28f71fd2bd1;hp=15f92775a4dc35f41a4e3cb6e8231c6b4a83dacb;hb=4fd1280540e2c9b90fa59c0c32d691f5222f65d4;hpb=88371c24e0b727646f0b01288f01439a06967fe7 diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html index 15f92775a..27df9622e 100644 --- a/httemplate/elements/tr-select-payment_options.html +++ b/httemplate/elements/tr-select-payment_options.html @@ -5,9 +5,9 @@ Example: include( '/elements/tr-select-payment_options.html', #opt - most get used in /elements/tr-amount-fee - 'custnum' => 4, # customer number needed for selecting invoices + 'cust_main' => $cust_main, # custmain needed for selecting invoices 'prefix' => 'pre', # prefix to fields and row ID's - 'amount' => 1, # payment amount + 'amount' => 1, # payment amount optional, if no amount will grab balance due from cust_main 'process-pkgpart' => scalar($conf->config('manual_process-pkgpart', $cust_main->agentnum)), 'process-display' => scalar($conf->config('manual_process-display')), 'process-skip_first' => $conf->exists('manual_process-skip_first'), @@ -22,75 +22,117 @@ Example: ? scalar($conf->config('credit-card-surcharge-flatfee', $cust_main->agentnum)) : 0 ), + 'processing_fee' => scalar($conf->config('processing-fee', $cust_main->agentnum)), ) - - <% mt('Payment options') |h %> - + + <% mt('What would you like to pay') |h %> + + <& /elements/tr-select-invoice.html, - 'custnum' => $opt{custnum}, - 'prefix' => $opt{prefix}, + 'cust_main' => $cust_main, + 'status' => 'open', + 'prefix' => $opt{prefix}, &> <& /elements/tr-amount_fee.html, - 'row_style' => 'STYLE="display:none;"', + 'amount' => $amount, + 'custnum' => $custnum, %opt &> <%init> my %opt = @_; +my $cust_main = $opt{'cust_main'}; +my $amount = $opt{'amount'} ? $opt{'amount'} : $cust_main->balance; +my $custnum = $cust_main->custnum; + +my @open_invoices = $cust_main->open_cust_bill; + +my $payment_option_row = "show"; +my $payment_amount_row = "hide"; + +unless ($amount > 0 && @open_invoices) { + $payment_option_row = "hide"; + $payment_amount_row = "show"; +} + my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$';