summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-10-31 19:28:23 +0000
committermark <mark>2010-10-31 19:28:23 +0000
commit5ff1cef039831955bff643d379dd594a6f79284c (patch)
tree3afec35e3ab35f74348bf3d73fdb860954e4b2c6
parent5311b0441b84bf1bd1cd2aba73092905d352f706 (diff)
no_prorate option for bulk packages, RT#9821
-rw-r--r--FS/FS/part_pkg/bulk.pm18
1 files changed, 14 insertions, 4 deletions
diff --git a/FS/FS/part_pkg/bulk.pm b/FS/FS/part_pkg/bulk.pm
index a346b9096..837c74ebd 100644
--- a/FS/FS/part_pkg/bulk.pm
+++ b/FS/FS/part_pkg/bulk.pm
@@ -7,7 +7,7 @@ use FS::part_pkg::flat;
@ISA = qw(FS::part_pkg::flat);
-$DEBUG = 1;
+$DEBUG = 0;
$me = '[FS::part_pkg::bulk]';
%info = (
@@ -33,9 +33,13 @@ $me = '[FS::part_pkg::bulk]';
'instead of a detailed list',
'type' => 'checkbox',
},
+ 'no_prorate' => { 'name' => 'Don\'t prorate recurring fees on new '.
+ 'services',
+ 'type' => 'checkbox',
+ },
},
'fieldorder' => [ 'setup_fee', 'recur_fee', 'svc_setup_fee', 'svc_recur_fee',
- 'unused_credit', 'summarize_svcs' ],
+ 'unused_credit', 'summarize_svcs', 'no_prorate' ],
'weight' => 50,
);
@@ -86,9 +90,15 @@ sub calc_recur {
my $svc_end = $h_cust_svc->date_deleted;
$svc_end = ( !$svc_end || $svc_end > $$sdate ) ? $$sdate : $svc_end;
- my $recur_charge =
- $self->option('svc_recur_fee') * ( $svc_end - $svc_start )
+ my $recur_charge;
+ if ( $self->option('no_prorate',1) ) {
+ $recur_charge = $self->option('svc_recur_fee');
+ }
+ else {
+ $recur_charge = $self->option('svc_recur_fee')
+ * ( $svc_end - $svc_start )
/ ( $$sdate - $last_bill );
+ }
$svc_details .= $money_char. sprintf('%.2f', $recur_charge ).
' ('. time2str('%x', $svc_start).