X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fbase_rate.pm;h=67819779915594bf31043e48bfefe01067b05ecb;hp=440e985185a6284ab1f09d33f4f9834218c33397;hb=74e058c8a010ef6feb539248a550d0bb169c1e94;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2 diff --git a/FS/FS/part_pkg/base_rate.pm b/FS/FS/part_pkg/base_rate.pm index 440e98518..678197799 100644 --- a/FS/FS/part_pkg/base_rate.pm +++ b/FS/FS/part_pkg/base_rate.pm @@ -12,23 +12,13 @@ use FS::part_pkg; # XXX it multiplies recurring fee by cust_pkg option "units", how to # express that 'shortname' => 'Bulk (manual from "units" option)', + 'inherit_fields' => [ 'global_Mixin' ], 'fields' => { - 'setup_fee' => { 'name' => 'Setup fee for this package', - 'default' => 0, - }, - 'recur_fee' => { 'name' => 'Recurring Base fee for this package', - 'default' => 0, - }, - 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. - ' of service at cancellation', - 'type' => 'checkbox', - }, - 'externalid' => { 'name' => 'Optional External ID', + 'externalid' => { 'name' => 'Optional External ID', 'default' => '', }, }, - 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', - 'externalid' ], + 'fieldorder' => [ qw( externalid ) ], 'weight' => 52, ); @@ -59,13 +49,10 @@ sub base_recur { } 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 = $options{'time'} || time; my $next_bill = $cust_pkg->getfield('bill') || 0; - my $last_bill = $cust_pkg->last_bill || 0; - return 0 if ! $self->base_recur($cust_pkg) - || ! $self->option('unused_credit', 1) - || ! $last_bill + return 0 if ! $self->base_recur($cust_pkg) || ! $next_bill || $next_bill < $time;