summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-discount_term.html
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-05-06 18:53:46 -0700
committerIvan Kohler <ivan@freeside.biz>2014-05-06 18:53:46 -0700
commit028c83edfa000f6bdbcd32ee3ffd5ee5561110d2 (patch)
tree8145b5b1d9d316d0bdd8b4150d867fcb566e7f45 /httemplate/elements/tr-select-discount_term.html
parent4bedcbc1559746f5aa2d2bbb9b26d6519ae47829 (diff)
config to turn on term discounts feature, fixing perf problems entering payments / manually processing cards, RT#27038
Diffstat (limited to 'httemplate/elements/tr-select-discount_term.html')
-rw-r--r--httemplate/elements/tr-select-discount_term.html5
1 files changed, 4 insertions, 1 deletions
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) {
</TR>
% }
-
<%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;