[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.17, 1.18 flat_delayed.pm, 1.5, 1.6 prorate.pm, 1.11, 1.12 prorate_delayed.pm, NONE, 1.1 subscription.pm, 1.10, 1.11
Ivan,,,
ivan at wavetail.420.am
Wed Aug 1 15:24:52 PDT 2007
- Previous message: [freeside-commits] freeside/FS/bin freeside-daily, 1.24, 1.25 freeside-monthly, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/t cust_event.t, NONE, 1.1 part_event-Action.t, NONE, 1.1 part_event-Condition.t, NONE, 1.1 part_event.t, NONE, 1.1 part_event_condition.t, NONE, 1.1 part_event_condition_option.t, NONE, 1.1 part_event_condition_option_option.t, NONE, 1.1 part_event_option.t, NONE, 1.1 pkg_referral.t, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail:/tmp/cvs-serv23435/FS/FS/part_pkg
Modified Files:
flat.pm flat_delayed.pm prorate.pm subscription.pm
Added Files:
prorate_delayed.pm
Log Message:
event refactor, landing on HEAD!
Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- prorate.pm 8 May 2007 22:43:27 -0000 1.11
+++ prorate.pm 1 Aug 2007 22:24:50 -0000 1.12
@@ -21,7 +21,7 @@
' of service at cancellation',
'type' => 'checkbox',
},
- 'cutoff_day' => { 'name' => 'billing day',
+ 'cutoff_day' => { 'name' => 'Billing_Day (1 - 28)',
'default' => 1,
},
'seconds' => { 'name' => 'Time limit for this package',
Index: flat_delayed.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat_delayed.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- flat_delayed.pm 23 Jan 2007 23:43:00 -0000 1.5
+++ flat_delayed.pm 1 Aug 2007 22:24:50 -0000 1.6
@@ -48,4 +48,21 @@
$self->option('setup_fee');
}
+sub calc_remain {
+ my ($self, $cust_pkg, %options) = @_;
+ my $next_bill = $cust_pkg->getfield('bill') || 0;
+ my $last_bill = $cust_pkg->last_bill || 0;
+ my $free_days = $self->option('free_days');
+
+ return 0 if $last_bill + (86400 * $free_days) == $next_bill
+ && $last_bill == $cust_pkg->setup;
+
+ return 0 if ! $self->base_recur
+ || ! $self->option('unused_credit', 1)
+ || ! $last_bill
+ || ! $next_bill;
+
+ return $self->SUPER::calc_remain($cust_pkg, %options);
+}
+
1;
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- flat.pm 8 May 2007 22:11:14 -0000 1.17
+++ flat.pm 1 Aug 2007 22:24:50 -0000 1.18
@@ -86,18 +86,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
Index: subscription.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/subscription.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- subscription.pm 8 May 2007 22:43:27 -0000 1.10
+++ subscription.pm 1 Aug 2007 22:24:50 -0000 1.11
@@ -89,8 +89,6 @@
$$sdate = timelocal(0,0,0,$cutoff_day,$mon,$year);
- $self->reset_usage($cust_pkg);
-
$self->option('recur_fee');
}
--- NEW FILE: prorate_delayed.pm ---
package FS::part_pkg::prorate_delayed;
use strict;
use vars qw(@ISA %info);
#use FS::Record qw(qsearch qsearchs);
use FS::part_pkg;
@ISA = qw(FS::part_pkg::prorate);
%info = (
'name' => 'Free (or setup fee) for X days, then prorate, then flat-rate ' .
'(1st of month billing)',
'fields' => {
'setup_fee' => { 'name' => 'Setup fee for this package',
'default' => 0,
},
'free_days' => { 'name' => 'Initial free days',
'default' => 0,
},
'recur_fee' => { 'name' => 'Recurring fee for this package',
'default' => 0,
},
'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
' of service at cancellation',
'type' => 'checkbox',
},
},
'fieldorder' => [ 'free_days', 'setup_fee', 'recur_fee', 'unused_credit' ],
#'setup' => '\'my $d = $cust_pkg->bill || $time; $d += 86400 * \' + what.free_days.value + \'; $cust_pkg->bill($d); $cust_pkg_mod_flag=1; \' + what.setup_fee.value',
#'recur' => 'what.recur_fee.value',
'weight' => 50,
);
sub calc_setup {
my($self, $cust_pkg, $time ) = @_;
my $d = $cust_pkg->bill || $time;
$d += 86400 * $self->option('free_days');
$cust_pkg->bill($d);
$self->option('setup_fee');
}
sub calc_remain {
my ($self, $cust_pkg, %options) = @_;
my $next_bill = $cust_pkg->getfield('bill') || 0;
my $last_bill = $cust_pkg->last_bill || 0;
my $free_days = $self->option('free_days');
return 0 if $last_bill + (86400 * $free_days) == $next_bill
&& $last_bill == $cust_pkg->setup;
return 0 if ! $self->base_recur
|| ! $self->option('unused_credit', 1)
|| ! $last_bill
|| ! $next_bill;
return $self->SUPER::calc_remain($cust_pkg, %options);
}
1;
- Previous message: [freeside-commits] freeside/FS/bin freeside-daily, 1.24, 1.25 freeside-monthly, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/t cust_event.t, NONE, 1.1 part_event-Action.t, NONE, 1.1 part_event-Condition.t, NONE, 1.1 part_event.t, NONE, 1.1 part_event_condition.t, NONE, 1.1 part_event_condition_option.t, NONE, 1.1 part_event_condition_option_option.t, NONE, 1.1 part_event_option.t, NONE, 1.1 pkg_referral.t, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list