summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/rate.pm4
-rw-r--r--httemplate/edit/process/rate_detail.html1
-rw-r--r--httemplate/edit/rate.cgi4
-rw-r--r--httemplate/view/cust_main/billing.html11
4 files changed, 14 insertions, 6 deletions
diff --git a/FS/FS/rate.pm b/FS/FS/rate.pm
index d30517051..50657ce5f 100644
--- a/FS/FS/rate.pm
+++ b/FS/FS/rate.pm
@@ -491,8 +491,8 @@ sub process {
warn "$rate replacing $old (". $param->{'ratenum'}. ")\n" if $DEBUG;
my @param = ( 'job'=>$job );
- push @param, 'rate_detail'=>\@rate_detail
- unless $param->{'preserve_rate_detail'};
+
+ $rate->default_detailnum($old->default_detailnum);
$error = $rate->replace( $old, @param );
diff --git a/httemplate/edit/process/rate_detail.html b/httemplate/edit/process/rate_detail.html
index 0709d5079..f8a744418 100644
--- a/httemplate/edit/process/rate_detail.html
+++ b/httemplate/edit/process/rate_detail.html
@@ -12,7 +12,6 @@ die "access denied"
my $set_default_detail = sub {
my ($cgi, $rate_detail) = @_;
-warn Dumper $rate_detail;
if (!$rate_detail->dest_regionnum) {
# then this is a global default rate
my $rate = $rate_detail->rate;
diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi
index 183ea8a42..1b052d62d 100644
--- a/httemplate/edit/rate.cgi
+++ b/httemplate/edit/rate.cgi
@@ -5,7 +5,7 @@
<% include('/elements/progress-init.html',
'OneTrueForm',
- [ 'rate', 'agentnum', 'preserve_rate_detail' ], # 'rate', 'min_', 'sec_' ],
+ [ 'rate', 'agentnum' ],
'process/rate.cgi',
$p.'browse/rate.cgi',
)
@@ -27,8 +27,6 @@
</TABLE>
<BR>
-<INPUT TYPE="hidden" NAME="preserve_rate_detail" VALUE="1">
-
<INPUT NAME="submit" TYPE="button" VALUE="<%
$rate->ratenum ? "Apply changes" : "Add rate plan"
%>" onClick="document.OneTrueForm.submit.disabled=true; process();">
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index ca48a7068..cc58cd74e 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -48,11 +48,13 @@
% 'hashref' => { 'custnum' => $cust_main->custnum, },
% 'extra_sql' => 'AND ( cancel IS NULL OR cancel = 0 )
% AND freq = '. dbh->quote($freq),
+% 'order_by' => 'ORDER BY COALESCE(start_date,0), pkgnum', # to ensure old pkgs come before change_to_pkg
% }) or next;
%
% my $freq_pretty = $cust_pkg[0]->part_pkg->freq_pretty;
%
% my $amount = 0;
+% my $skip_pkg = {};
% foreach my $cust_pkg (@cust_pkg) {
% my $part_pkg = $cust_pkg->part_pkg;
% next if $cust_pkg->susp
@@ -61,6 +63,15 @@
% || $cust_pkg->option('no_suspend_bill')
% );
%
+% #pkg change handling
+% next if $skip_pkg->{$cust_pkg->pkgnum};
+% if ($cust_pkg->change_to_pkgnum) {
+% #if change is on or before next bill date, use new pkg
+% next if $cust_pkg->expire <= $cust_pkg->bill;
+% #if change is after next bill date, use old (this) pkg
+% $skip_pkg->{$cust_pkg->change_to_pkgnum} = 1;
+% }
+%
% my $pkg_amount = 0;
%
% #add recurring amounts for this package and its billing add-ons