diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2013-04-29 18:17:04 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2013-04-29 18:17:04 -0700 |
| commit | a03ef407980e86079b82383069c5bef037bac2d5 (patch) | |
| tree | 3c17f0f40e19492555c12351a19cf50de6987dd9 | |
| parent | 24377ec7e7ec840cad72003262f6fe3b7158cafb (diff) | |
add monthly cap to daily RADIUS usage, RT#22699
| -rw-r--r-- | FS/FS/part_pkg/sqlradacct_daily.pm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/FS/FS/part_pkg/sqlradacct_daily.pm b/FS/FS/part_pkg/sqlradacct_daily.pm index d99def21b..d0d3e1006 100644 --- a/FS/FS/part_pkg/sqlradacct_daily.pm +++ b/FS/FS/part_pkg/sqlradacct_daily.pm @@ -66,8 +66,13 @@ use Date::Format; 'default' => 0, }, + 'monthly_cap' => { 'name' => 'Monthly (billing frequency) cap on all overage charges'. + ' (0 means no cap)', + 'default' => 0, + }, + }, - 'fieldorder' => [qw( recur_included_hours recur_hourly_charge recur_hourly_cap recur_included_input recur_input_charge recur_input_cap recur_included_output recur_output_charge recur_output_cap recur_included_total recur_total_charge recur_total_cap global_cap )], + 'fieldorder' => [qw( recur_included_hours recur_hourly_charge recur_hourly_cap recur_included_input recur_input_charge recur_input_cap recur_included_output recur_output_charge recur_output_cap recur_included_total recur_total_charge recur_total_cap global_cap monthly_cap )], 'weight' => 41, ); @@ -79,7 +84,7 @@ sub price_info { } #hacked-up false laziness w/sqlradacct_hour, -# but keeping it separate to start with is safer for existing folks +# but keeping it separate to start with is safer for existing folks sub calc_recur { my($self, $cust_pkg, $sdate, $details ) = @_; @@ -179,6 +184,10 @@ sub calc_recur { $day_start = $tomorrow; } + $charges = $self->option('monthly_cap') + if $self->option('monthly_cap') + && $charges > $self->option('monthly_cap'); + $self->option('recur_fee') + $charges; } |
