X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fbase_rate.pm;h=440e985185a6284ab1f09d33f4f9834218c33397;hp=04896e0fd490beb54c98512a2a59507ee081f43d;hb=94a66b78bcda5605d7ee5eb7c3e692fb2fe5cf2c;hpb=5e05724a635a22776f1b973f5d7e77989da4e048 diff --git a/FS/FS/part_pkg/base_rate.pm b/FS/FS/part_pkg/base_rate.pm index 04896e0fd..440e98518 100644 --- a/FS/FS/part_pkg/base_rate.pm +++ b/FS/FS/part_pkg/base_rate.pm @@ -9,6 +9,9 @@ use FS::part_pkg; %info = ( 'name' => 'Base rate (anniversary billing, Times units ordered)', + # XXX it multiplies recurring fee by cust_pkg option "units", how to + # express that + 'shortname' => 'Bulk (manual from "units" option)', 'fields' => { 'setup_fee' => { 'name' => 'Setup fee for this package', 'default' => 0, @@ -26,7 +29,7 @@ use FS::part_pkg; }, 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'externalid' ], - 'weight' => 10, + 'weight' => 52, ); sub calc_setup { @@ -60,7 +63,7 @@ sub calc_remain { my $time = time; #should be able to pass this in for credit calculation my $next_bill = $cust_pkg->getfield('bill') || 0; my $last_bill = $cust_pkg->last_bill || 0; - return 0 if ! $self->base_recur + return 0 if ! $self->base_recur($cust_pkg) || ! $self->option('unused_credit', 1) || ! $last_bill || ! $next_bill @@ -78,7 +81,7 @@ sub calc_remain { my $freq_sec = $1 * $sec{$2||'m'}; return 0 unless $freq_sec; - sprintf("%.2f", $self->base_recur * ( $next_bill - $time ) / $freq_sec ); + sprintf("%.2f", $self->base_recur($cust_pkg) * ( $next_bill - $time ) / $freq_sec ); }