[freeside-commits] branch FREESIDE_3_BRANCH updated. dfc390ed3e27de2f1ec26edf9c07f5d3bd8a6049
Ivan
ivan at 420.am
Tue May 6 18:53:49 PDT 2014
The branch, FREESIDE_3_BRANCH has been updated
via dfc390ed3e27de2f1ec26edf9c07f5d3bd8a6049 (commit)
from 0e50833deb77ce7eff66fe7da5d68647b82d7280 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit dfc390ed3e27de2f1ec26edf9c07f5d3bd8a6049
Author: Ivan Kohler <ivan at freeside.biz>
Date: Tue May 6 18:53:48 2014 -0700
config to turn on term discounts feature, fixing perf problems entering payments / manually processing cards, RT#27038
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index e489bca..751a959 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -5687,6 +5687,13 @@ and customer address. Include units.',
},
},
+ {
+ 'key' => 'part_pkg-term_discounts',
+ 'section' => 'billing',
+ 'description' => 'Enable the term discounts feature. Recommended to keep turned off unless actually using - not well optimized for large installations.',
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
index d4414e4..ec7391b 100755
--- a/httemplate/edit/cust_pay.cgi
+++ b/httemplate/edit/cust_pay.cgi
@@ -56,10 +56,12 @@
<TD><INPUT TYPE="text" NAME="paid" ID="paid" VALUE="<% $paid %>" SIZE=8 MAXLENGTH=9> <% mt('by') |h %> <B><% mt(FS::payby->payname($payby)) |h %></B></TD>
</TR>
- <& /elements/tr-select-discount_term.html,
- 'custnum' => $custnum,
- 'amount_id' => 'paid',
- &>
+% if ( $conf->exists('part_pkg-term_discounts') ) {
+ <& /elements/tr-select-discount_term.html,
+ 'custnum' => $custnum,
+ 'amount_id' => 'paid',
+ &>
+% }
% if ( $payby eq 'BILL' ) {
<TR>
diff --git a/httemplate/elements/tr-select-discount_term.html b/httemplate/elements/tr-select-discount_term.html
index d4218f8..171c103 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;
diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi
index 5b9f63d..90b03c7 100644
--- a/httemplate/misc/payment.cgi
+++ b/httemplate/misc/payment.cgi
@@ -20,10 +20,12 @@
'surcharge_percentage' => scalar($conf->config('credit-card-surcharge-percentage')),
&>
- <& /elements/tr-select-discount_term.html,
- 'custnum' => $custnum,
- 'amount_id' => 'amount',
- &>
+% if ( $conf->exists('part_pkg-term_discounts') ) {
+ <& /elements/tr-select-discount_term.html,
+ 'custnum' => $custnum,
+ 'amount_id' => 'amount',
+ &>
+% }
% if ( $payby eq 'CARD' ) {
%
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Conf.pm | 7 +++++++
httemplate/edit/cust_pay.cgi | 10 ++++++----
httemplate/elements/tr-select-discount_term.html | 5 ++++-
httemplate/misc/payment.cgi | 10 ++++++----
4 files changed, 23 insertions(+), 9 deletions(-)
More information about the freeside-commits
mailing list