[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.9,
1.10 prorate.pm, 1.9, 1.10 subscription.pm, 1.8, 1.9
Jeff Finucane,420,,
jeff at wavetail.420.am
Wed Dec 6 18:40:33 PST 2006
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail:/tmp/cvs-serv19099/FS/FS/part_pkg
Modified Files:
flat.pm prorate.pm subscription.pm
Log Message:
retouch bandwidth countdown
Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- prorate.pm 1 May 2006 13:09:11 -0000 1.9
+++ prorate.pm 7 Dec 2006 02:40:31 -0000 1.10
@@ -24,12 +24,40 @@
'cutoff_day' => { 'name' => 'billing day',
'default' => 1,
},
+ 'seconds' => { 'name' => 'Time limit for this package',
+ 'default' => '',
+ },
+ 'upbytes' => { 'name' => 'Upload limit for this package',
+ 'default' => '',
+ },
+ 'downbytes' => { 'name' => 'Download limit for this package',
+ 'default' => '',
+ },
+ 'totalbytes' => { 'name' => 'Transfer limit for this package',
+ 'default' => '',
+ },
+ 'recharge_amount' => { 'name' => 'Cost of recharge for this package',
+ 'default' => '',
+ },
+ 'recharge_seconds' => { 'name' => 'Recharge time for this package',
+ 'default' => '',
+ },
+ 'recharge_upbytes' => { 'name' => 'Recharge upload for this package',
+ 'default' => '',
+ },
+ 'recharge_downbytes' => { 'name' => 'Recharge download for this package', 'default' => '',
+ },
+ 'recharge_totalbytes' => { 'name' => 'Recharge transfer for this package', 'default' => '',
+ },
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
'default' => '',
},
},
'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'cutoff_day',
+ 'seconds', 'upbyte', 'downbytes', 'totalbytes',
+ 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
+ 'recharge_downbytes', 'recharge_totalbytes',
'externalid', ],
'freq' => 'm',
'weight' => 20,
@@ -43,6 +71,8 @@
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.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- flat.pm 21 Apr 2006 14:20:05 -0000 1.9
+++ flat.pm 7 Dec 2006 02:40:31 -0000 1.10
@@ -23,8 +23,39 @@
'externalid' => { 'name' => 'Optional External ID',
'default' => '',
},
+ 'seconds' => { 'name' => 'Time limit for this package',
+ 'default' => '',
+ },
+ 'upbytes' => { 'name' => 'Upload limit for this package',
+ 'default' => '',
+ },
+ 'downbytes' => { 'name' => 'Download limit for this package',
+ 'default' => '',
+ },
+ 'totalbytes' => { 'name' => 'Transfer limit for this package',
+ 'default' => '',
+ },
+ 'recharge_amount' => { 'name' => 'Cost of recharge for this package',
+ 'default' => '',
+ },
+ 'recharge_seconds' => { 'name' => 'Recharge time for this package',
+ 'default' => '',
+ },
+ 'recharge_upbytes' => { 'name' => 'Recharge upload for this package',
+ 'default' => '',
+ },
+ 'recharge_downbytes' => { 'name' => 'Recharge download for this package',
+ 'default' => '',
+ },
+ 'recharge_totalbytes' => { 'name' => 'Recharge transfer for this package',
+ 'default' => '',
+ },
},
- 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'externalid' ],
+ 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit',
+ 'seconds', 'upbytes', 'downbytes', 'totalbytes',
+ 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
+ 'recharge_downbytes', 'recharge_totalbytes',
+ 'externalid' ],
'weight' => 10,
);
@@ -34,8 +65,9 @@
}
sub calc_recur {
- my $self = shift;
- $self->base_recur(@_);
+ my($self, $cust_pkg) = @_;
+ $self->reset_usage($cust_pkg);
+ $self->base_recur($cust_pkg);
}
sub base_recur {
@@ -78,4 +110,12 @@
0; #no, we're postpaid
}
+sub reset_usage {
+ my($self, $cust_pkg) = @_;
+ my %values = map { $_, $self->option($_) }
+ grep { $self->option($_) }
+ qw(seconds upbytes downbytes totalbytes);
+ $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.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- subscription.pm 1 May 2006 12:38:06 -0000 1.8
+++ subscription.pm 7 Dec 2006 02:40:31 -0000 1.9
@@ -20,13 +20,46 @@
'cutoff_day' => { 'name' => 'billing day',
'default' => 1,
},
+ 'seconds' => { 'name' => 'Time limit for this package',
+ 'default' => '',
+ },
+ 'upbytes' => { 'name' => 'Upload limit for this package',
+ 'default' => '',
+ },
+ 'downbytes' => { 'name' => 'Download limit for this package',
+ 'default' => '',
+ },
+ 'totalbytes' => { 'name' => 'Transfer limit for this package',
+ 'default' => '',
+ },
+ 'recharge_amount' => { 'name' => 'Cost of recharge for this package',
+ 'default' => '',
+ },
+ 'recharge_seconds' => { 'name' => 'Recharge time for this package',
+ 'default' => '',
+ },
+ 'recharge_upbytes' => { 'name' => 'Recharge upload for this package',
+ 'default' => '',
+ },
+ 'recharge_downbytes' => { 'name' => 'Recharge download for this package', 'default' => '',
+ },
+ 'recharge_totalbytes' => { 'name' => 'Recharge transfer for this package', 'default' => '',
+ },
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
'default' => '',
},
},
- 'fieldorder' => [ 'setup_fee', 'recur_fee', 'cutoff_day', 'externalid' ],
- 'fieldorder' => [ 'setup_fee', 'recur_fee','cutoff_day'],
+ 'fieldorder' => [ 'setup_fee', 'recur_fee', 'cutoff_day', 'seconds',
+ 'upbytes', 'downbytes', 'totalbytes',
+ 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
+ 'recharge_downbytes', 'recharge_totalbytes',
+ 'externalid' ],
+ 'fieldorder' => [ 'setup_fee', 'recur_fee','cutoff_day', 'seconds',
+ 'upbytes', 'downbytes', 'totalbytes',
+ 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
+ 'recharge_downbytes', 'recharge_totalbytes',
+ ],
'freq' => 'm',
'weight' => 30,
);
@@ -44,6 +77,8 @@
$$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