[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.13.2.9, 1.13.2.10 voip_cdr.pm, 1.3.2.11, 1.3.2.12
Ivan,,,
ivan at wavetail.420.am
Thu Sep 11 17:53:47 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv20289
Modified Files:
Tag: FREESIDE_1_7_BRANCH
flat.pm voip_cdr.pm
Log Message:
add recur_temporality to flat.pm, RT#3851
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.3.2.11
retrieving revision 1.3.2.12
diff -u -d -r1.3.2.11 -r1.3.2.12
--- voip_cdr.pm 10 Sep 2008 07:30:56 -0000 1.3.2.11
+++ voip_cdr.pm 12 Sep 2008 00:53:44 -0000 1.3.2.12
@@ -42,7 +42,7 @@
'default' => 0,
},
- #probably useful for other usage-charging price plans
+ #false laziness w/flat.pm
'recur_temporality' => { 'name' => 'Charge recurring fee for period',
'type' => 'select',
'select_options' => \%temporalities,
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.13.2.9
retrieving revision 1.13.2.10
diff -u -d -r1.13.2.9 -r1.13.2.10
--- flat.pm 5 Jun 2008 20:09:34 -0000 1.13.2.9
+++ flat.pm 12 Sep 2008 00:53:44 -0000 1.13.2.10
@@ -2,12 +2,18 @@
use strict;
use vars qw(@ISA %info);
+use Tie::IxHash;
#use FS::Record qw(qsearch);
use FS::UI::bytecount;
use FS::part_pkg;
@ISA = qw(FS::part_pkg);
+tie my %temporalities, 'Tie::IxHash',
+ 'upcoming' => "Upcoming (future)",
+ 'preceding' => "Preceding (past)",
+;
+
%info = (
'name' => 'Flat rate (anniversary billing)',
'fields' => {
@@ -17,6 +23,13 @@
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
+
+ #false laziness w/voip_cdr.pm
+ 'recur_temporality' => { 'name' => 'Charge recurring fee for period',
+ 'type' => 'select',
+ 'select_options' => \%temporalities,
+ },
+
'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
' of service at cancellation',
'type' => 'checkbox',
@@ -81,11 +94,13 @@
'type' => 'checkbox',
},
},
- 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit',
- 'seconds', 'upbytes', 'downbytes', 'totalbytes',
- 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
- 'recharge_downbytes', 'recharge_totalbytes',
- 'usage_rollover', 'recharge_reset', 'externalid' ],
+ 'fieldorder' => [qw( setup_fee recur_fee recur_temporality unused_credit
+ seconds upbytes downbytes totalbytes
+ recharge_amount recharge_seconds recharge_upbytes
+ recharge_downbytes recharge_totalbytes
+ usage_rollover recharge_reset externalid
+ )
+ ],
'weight' => 10,
);
@@ -111,6 +126,13 @@
sub calc_recur {
my($self, $cust_pkg) = @_;
+
+ #my $last_bill = $cust_pkg->last_bill;
+ my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup
+
+ return 0
+ if $self->option('recur_temporality') eq 'preceding' && $last_bill == 0;
+
$self->base_recur($cust_pkg);
}
More information about the freeside-commits
mailing list