From dfc390ed3e27de2f1ec26edf9c07f5d3bd8a6049 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 6 May 2014 18:53:48 -0700 Subject: config to turn on term discounts feature, fixing perf problems entering payments / manually processing cards, RT#27038 --- httemplate/elements/tr-select-discount_term.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/tr-select-discount_term.html b/httemplate/elements/tr-select-discount_term.html index d4218f848..171c1037a 100644 --- a/httemplate/elements/tr-select-discount_term.html +++ b/httemplate/elements/tr-select-discount_term.html @@ -34,8 +34,8 @@ function change_discount_term(what) { % } - <%init> + my %opt = @_; my $custnum = $opt{'custnum'}; @@ -45,7 +45,10 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) my @discount_term = (); my %discounted_total = (); + +#this is inefficient for many years worth of invoices my $last_bill = ($cust_main->cust_bill)[-1]; + if ( $last_bill ) { # if not, there are no discounts possible my %plans = $last_bill->discount_plans; @discount_term = sort { $a <=> $b } keys %plans; -- cgit v1.2.1