[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.13.2.5, 1.13.2.6 prorate.pm, 1.10.2.3, 1.10.2.4 subscription.pm, 1.9.2.2, 1.9.2.3
Jeff Finucane,420,,
jeff at wavetail.420.am
Fri Dec 21 13:38:14 PST 2007
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail:/tmp/cvs-serv5142/part_pkg
Modified Files:
Tag: FREESIDE_1_7_BRANCH
flat.pm prorate.pm subscription.pm
Log Message:
backport flat, prorate, and subscription plans
Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -u -d -r1.10.2.3 -r1.10.2.4
--- prorate.pm 1 Dec 2007 01:37:39 -0000 1.10.2.3
+++ prorate.pm 21 Dec 2007 21:38:11 -0000 1.10.2.4
@@ -70,6 +70,10 @@
'format' => \&FS::UI::bytecount::display_bytecount,
'parse' => \&FS::UI::bytecount::parse_bytecount,
},
+ 'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+ 'over into current period',
+ 'type' => 'checkbox',
+ },
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
'default' => '',
@@ -79,7 +83,7 @@
'seconds', 'upbyte', 'downbytes', 'totalbytes',
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
- 'externalid', ],
+ 'usage_rollover', 'externalid', ],
'freq' => 'm',
'weight' => 20,
);
@@ -92,8 +96,6 @@
my $mend;
my $mstart;
- $self->reset_usage($cust_pkg);
-
if ( $mday >= $cutoff_day ) {
$mend =
timelocal(0,0,0,$cutoff_day, $mon == 11 ? 0 : $mon+1, $year+($mon==11));
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.13.2.5
retrieving revision 1.13.2.6
diff -u -d -r1.13.2.5 -r1.13.2.6
--- flat.pm 4 Oct 2007 02:06:53 -0000 1.13.2.5
+++ flat.pm 21 Dec 2007 21:38:10 -0000 1.13.2.6
@@ -72,12 +72,16 @@
'format' => \&FS::UI::bytecount::display_bytecount,
'parse' => \&FS::UI::bytecount::parse_bytecount,
},
+ 'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+ ' over into current period',
+ 'type' => 'checkbox',
+ },
},
'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit',
'seconds', 'upbytes', 'downbytes', 'totalbytes',
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
- 'externalid' ],
+ 'usage_rollover', 'externalid' ],
'weight' => 10,
);
@@ -95,18 +99,24 @@
sub calc_recur {
my($self, $cust_pkg) = @_;
- $self->reset_usage($cust_pkg);
$self->base_recur($cust_pkg);
}
sub base_recur {
my($self, $cust_pkg) = @_;
- $self->option('recur_fee');
+ $self->option('recur_fee', 1) || 0;
}
sub calc_remain {
- my ($self, $cust_pkg) = @_;
- my $time = time; #should be able to pass this in for credit calculation
+ my ($self, $cust_pkg, %options) = @_;
+
+ my $time;
+ if ($options{'time'}) {
+ $time = $options{'time'};
+ } else {
+ $time = time;
+ }
+
my $next_bill = $cust_pkg->getfield('bill') || 0;
my $last_bill = $cust_pkg->last_bill || 0;
return 0 if ! $self->base_recur
@@ -144,7 +154,11 @@
my %values = map { $_, $self->option($_) }
grep { $self->option($_, 'hush') }
qw(seconds upbytes downbytes totalbytes);
- $cust_pkg->set_usage(\%values);
+ if ($self->option('usage_rollover', 1)) {
+ $cust_pkg->recharge(\%values);
+ }else{
+ $cust_pkg->set_usage(\%values);
+ }
}
1;
Index: subscription.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/subscription.pm,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- subscription.pm 4 Oct 2007 02:06:53 -0000 1.9.2.2
+++ subscription.pm 21 Dec 2007 21:38:11 -0000 1.9.2.3
@@ -66,6 +66,10 @@
'format' => \&FS::UI::bytecount::display_bytecount,
'parse' => \&FS::UI::bytecount::parse_bytecount,
},
+ 'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
+ 'over into current period',
+ 'type' => 'checkbox',
+ },
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
'default' => '',
@@ -80,6 +84,7 @@
'upbytes', 'downbytes', 'totalbytes',
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
+ 'usage_rollover',
],
'freq' => 'm',
'weight' => 30,
@@ -98,8 +103,6 @@
$$sdate = timelocal(0,0,0,$cutoff_day,$mon,$year);
- $self->reset_usage($cust_pkg);
-
$self->option('recur_fee');
}
More information about the freeside-commits
mailing list