[freeside-commits] branch FREESIDE_2_3_BRANCH updated. a03ef407980e86079b82383069c5bef037bac2d5

Ivan ivan at 420.am
Mon Apr 29 18:17:05 PDT 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  a03ef407980e86079b82383069c5bef037bac2d5 (commit)
      from  24377ec7e7ec840cad72003262f6fe3b7158cafb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a03ef407980e86079b82383069c5bef037bac2d5
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 29 18:17:04 2013 -0700

    add monthly cap to daily RADIUS usage, RT#22699

diff --git a/FS/FS/part_pkg/sqlradacct_daily.pm b/FS/FS/part_pkg/sqlradacct_daily.pm
index d99def2..d0d3e10 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;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg/sqlradacct_daily.pm |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list