[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.25, 1.26 voip_cdr.pm, 1.27, 1.28
Ivan,,,
ivan at wavetail.420.am
Thu Sep 11 17:53:17 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv20287
Modified Files:
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.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- voip_cdr.pm 10 Sep 2008 07:30:45 -0000 1.27
+++ voip_cdr.pm 12 Sep 2008 00:53:13 -0000 1.28
@@ -43,7 +43,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.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- flat.pm 5 Jun 2008 20:09:21 -0000 1.25
+++ flat.pm 12 Sep 2008 00:53:13 -0000 1.26
@@ -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)',
'shortname' => 'Anniversary',
@@ -18,6 +24,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',
@@ -82,11 +95,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,
);
@@ -112,6 +127,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