[freeside-commits] freeside/FS/FS/part_pkg cdr_termination.pm, 1.9, 1.10 flat.pm, 1.64, 1.65 prorate.pm, 1.28, 1.29 prorate_Mixin.pm, 1.14, 1.15 recur_Common.pm, 1.11, 1.12 sql_external.pm, 1.14, 1.15 voip_cdr.pm, 1.122, 1.123 voip_inbound.pm, 1.11, 1.12
Mark Wells
mark at wavetail.420.am
Fri Jun 17 02:47:06 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv14176/part_pkg
Modified Files:
cdr_termination.pm flat.pm prorate.pm prorate_Mixin.pm
recur_Common.pm sql_external.pm voip_cdr.pm voip_inbound.pm
Log Message:
add prorate options to recur_Common packages, #10630
Index: prorate_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate_Mixin.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -d -r1.14 -r1.15
--- prorate_Mixin.pm 9 May 2011 20:31:10 -0000 1.14
+++ prorate_Mixin.pm 17 Jun 2011 09:47:04 -0000 1.15
@@ -7,8 +7,30 @@
@ISA = qw(FS::part_pkg);
%info = (
'disabled' => 1,
+ # define all fields that are referenced in this code
+ 'fields' => {
+ 'add_full_period' => {
+ 'name' => 'When prorating first month, also bill for one full '.
+ 'period after that',
+ 'type' => 'checkbox',
+ },
+ 'prorate_round_day' => {
+ 'name' => 'When prorating, round to the nearest full day',
+ 'type' => 'checkbox',
+ },
+ 'prorate_defer_bill' => {
+ 'name' => 'When prorating, defer the first bill until the '.
+ 'billing day',
+ 'type' => 'checkbox',
+ },
+ },
+ 'fieldorder' => [ qw(prorate_defer_bill prorate_round_day add_full_period) ],
);
+sub fieldorder {
+ @{ $info{'fieldorder'} }
+}
+
=head1 NAME
FS::part_pkg::prorate_Mixin - Mixin class for part_pkg:: classes that
@@ -134,7 +156,13 @@
# only works for freq >= 1 month; probably can't be fixed
my ($sec, $min, $hour, $mday, $mon, $year) = (localtime($mnow))[0..5];
if( $self->option('prorate_round_day',1) ) {
- $mday++ if $hour >= 12;
+ # If the time is 12:00-23:59, move to the next day by adding 18
+ # hours to $mnow. Because of DST this can end up from 05:00 to 18:59
+ # but it's always within the next day.
+ $mnow += 64800 if $hour >= 12;
+ # Get the new day, month, and year.
+ ($mday,$mon,$year) = (localtime($mnow))[3..5];
+ # Then set $mnow to midnight on that day.
$mnow = timelocal(0,0,0,$mday,$mon,$year);
}
my $mend;
Index: sql_external.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/sql_external.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -d -r1.14 -r1.15
--- sql_external.pm 12 Feb 2011 04:56:57 -0000 1.14
+++ sql_external.pm 17 Jun 2011 09:47:04 -0000 1.15
@@ -9,16 +9,12 @@
%info = (
'name' => 'Base charge plus additional fees for external services from a configurable SQL query',
'shortname' => 'External SQL query',
- 'inherit_fields' => [ 'global_Mixin' ],
+ 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
'fields' => {
'cutoff_day' => { 'name' => 'Billing Day (1 - 28) for prorating or '.
'subscription',
'default' => '1',
},
- 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
- 'for one full period after that',
- 'type' => 'checkbox',
- },
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
@@ -39,8 +35,9 @@
'default' => '',
},
},
- 'fieldorder' => [qw( recur_method cutoff_day
- add_full_period datasrc db_username db_password query
+ 'fieldorder' => [qw( recur_method cutoff_day ),
+ FS::part_pkg::prorate_Mixin::fieldorder,
+ qw( datasrc db_username db_password query
)],
'weight' => '58',
);
Index: recur_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/recur_Common.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- recur_Common.pm 15 Mar 2011 23:32:18 -0000 1.11
+++ recur_Common.pm 17 Jun 2011 09:47:04 -0000 1.12
@@ -19,6 +19,13 @@
$self->option('recur_fee', 1) || 0;
}
+sub calc_setup {
+ # moved from all descendant packages which just had $self->option('setup_fee')
+ my($self, $cust_pkg, $sdate, $details, $param) = @_;
+ return 0 if $self->prorate_setup($cust_pkg, $sdate);
+ $self->option('setup_fee');
+}
+
sub cutoff_day {
# prorate/subscription only; we don't support sync_bill_date here
my $self = shift;
Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -w -d -r1.28 -r1.29
--- prorate.pm 15 Mar 2011 23:32:18 -0000 1.28
+++ prorate.pm 17 Jun 2011 09:47:04 -0000 1.29
@@ -24,8 +24,8 @@
'type' => 'checkbox',
},
'prorate_round_day'=> {
- 'name' => 'When prorating first month, round to '.
- 'the nearest full day',
+ 'name' => 'Round the prorated period to the nearest '.
+ 'full day',
'type' => 'checkbox',
},
'prorate_defer_bill'=> {
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -w -d -r1.122 -r1.123
--- voip_cdr.pm 17 Jun 2011 02:48:44 -0000 1.122
+++ voip_cdr.pm 17 Jun 2011 09:47:04 -0000 1.123
@@ -46,7 +46,7 @@
%info = (
'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
'shortname' => 'VoIP/telco CDR rating (standard)',
- 'inherit_fields' => [ 'global_Mixin' ],
+ 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
'fields' => {
'suspend_bill' => { 'name' => 'Continue recurring billing while suspended',
'type' => 'checkbox',
@@ -61,10 +61,6 @@
'subscription',
'default' => '1',
},
- 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
- 'for one full period after that',
- 'type' => 'checkbox',
- },
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
#'options' => \%recur_method,
@@ -259,8 +255,9 @@
},
'fieldorder' => [qw(
recur_temporality
- recur_method cutoff_day
- add_full_period
+ recur_method cutoff_day ),
+ FS::part_pkg::prorate_Mixin::fieldorder,
+ qw(
cdr_svc_method
rating_method ratenum intrastate_ratenum
min_charge min_included
@@ -299,11 +296,6 @@
$str;
}
-sub calc_setup {
- my($self, $cust_pkg ) = @_;
- $self->option('setup_fee');
-}
-
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -w -d -r1.64 -r1.65
--- flat.pm 6 May 2011 00:30:07 -0000 1.64
+++ flat.pm 17 Jun 2011 09:47:04 -0000 1.65
@@ -25,7 +25,7 @@
%info = (
'name' => 'Flat rate (anniversary billing)',
'shortname' => 'Anniversary',
- 'inherit_fields' => [ 'usage_Mixin', 'global_Mixin' ],
+ 'inherit_fields' => [ 'prorate_Mixin', 'usage_Mixin', 'global_Mixin' ],
'fields' => {
#false laziness w/voip_cdr.pm
'recur_temporality' => { 'name' => 'Charge recurring fee for period',
@@ -56,6 +56,13 @@
'the customer\'s next bill date',
'type' => 'checkbox',
},
+ 'prorate_round_day' => {
+ 'name' => 'When synchronizing, round the prorated '.
+ 'period to the nearest full day',
+ 'type' => 'checkbox',
+ },
+ 'add_full_period' => { 'disabled' => 1 }, # doesn't make sense with sync?
+
'suspend_bill' => { 'name' => 'Continue recurring billing while suspended',
'type' => 'checkbox',
},
@@ -72,7 +79,8 @@
'fieldorder' => [ qw( recur_temporality
expire_months adjourn_months
contract_end_months
- start_1st sync_bill_date prorate_defer_bill
+ start_1st
+ sync_bill_date prorate_defer_bill prorate_round_day
suspend_bill unsuspend_adjust_bill
externalid ),
],
Index: voip_inbound.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_inbound.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- voip_inbound.pm 17 Jun 2011 02:48:44 -0000 1.11
+++ voip_inbound.pm 17 Jun 2011 09:47:04 -0000 1.12
@@ -24,7 +24,7 @@
%info = (
'name' => 'VoIP flat rate pricing of CDRs for inbound calls',
'shortname' => 'VoIP/telco CDR rating (inbound)',
- 'inherit_fields' => [ 'global_Mixin' ],
+ 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
'fields' => {
#false laziness w/flat.pm
'recur_temporality' => { 'name' => 'Charge recurring fee for period',
@@ -35,10 +35,6 @@
'subscription',
'default' => '1',
},
- 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
- 'for one full period after that',
- 'type' => 'checkbox',
- },
'recur_method' => { 'name' => 'Recurring fee method',
'type' => 'select',
@@ -148,8 +144,9 @@
},
'fieldorder' => [qw(
recur_temporality
- recur_method cutoff_day add_full_period
- min_charge min_included sec_granularity
+ recur_method cutoff_day ),
+ FS::part_pkg::prorate_Mixin::fieldorder,
+ qw( min_charge min_included sec_granularity
default_prefix
disable_tollfree
use_amaflags
@@ -173,11 +170,6 @@
$str;
}
-sub calc_setup {
- my($self, $cust_pkg ) = @_;
- $self->option('setup_fee');
-}
-
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
Index: cdr_termination.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/cdr_termination.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -d -r1.9 -r1.10
--- cdr_termination.pm 8 Apr 2011 01:00:37 -0000 1.9
+++ cdr_termination.pm 17 Jun 2011 09:47:03 -0000 1.10
@@ -16,7 +16,7 @@
%info = (
'name' => 'VoIP rating of CDR records for termination partners.',
'shortname' => 'VoIP/telco CDR termination',
- 'inherit_fields' => [ 'global_Mixin' ],
+ 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
'fields' => {
#'cdr_column' => { 'name' => 'Column from CDR records',
# 'type' => 'select',
@@ -46,11 +46,6 @@
'subscription',
'default' => '1',
},
- 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
- 'for one full period after that',
- 'type' => 'checkbox',
- },
-
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
#'options' => \%recur_method,
@@ -79,9 +74,9 @@
},
#cdr_column
- 'fieldorder' => [qw(
- recur_temporality recur_method cutoff_day
- add_full_period
+ 'fieldorder' => [qw( recur_temporality recur_method cutoff_day ),
+ FS::part_pkg::prorate_Mixin::fieldorder,
+ qw(
output_format usage_section summarize_usage usage_mandate
)
],
@@ -90,11 +85,6 @@
);
-sub calc_setup {
- my($self, $cust_pkg ) = @_;
- $self->option('setup_fee');
-}
-
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
More information about the freeside-commits
mailing list