[freeside-commits] branch master updated. 41466beaadfad0627adf5559d173e1bcc2829939

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


The branch, master has been updated
       via  41466beaadfad0627adf5559d173e1bcc2829939 (commit)
      from  97c67d2bf226fbe1cea8aceef36c24c3c406b74f (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 41466beaadfad0627adf5559d173e1bcc2829939
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Apr 29 18:17:03 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