[freeside-commits] branch master updated. e2213aaeab76983c26d92c1e1d928fe4e062accf

Ivan ivan at 420.am
Fri Dec 12 18:37:48 PST 2014


The branch, master has been updated
       via  e2213aaeab76983c26d92c1e1d928fe4e062accf (commit)
      from  6bab3cf66992f581d35ae57c633a81e8503d5c35 (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 e2213aaeab76983c26d92c1e1d928fe4e062accf
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Dec 12 18:37:47 2014 -0800

    agent wholesale bulk billing: option to use cost only, disabling fallback to price, RT#32481

diff --git a/FS/FS/part_pkg/agent.pm b/FS/FS/part_pkg/agent.pm
index 37e7d9d..d926997 100644
--- a/FS/FS/part_pkg/agent.pm
+++ b/FS/FS/part_pkg/agent.pm
@@ -40,6 +40,10 @@ $me = '[FS::part_pkg::agent]';
                                 'type' => 'checkbox',
                               },
 
+    'cost_only' => { 'name' => 'Bill wholesale on cost only, disabling the price fallback',
+                     'type' => 'checkbox' 
+                   },
+
   },
 
   'fieldorder' => [qw( cutoff_day add_full_period no_pkg_prorate ) ],
@@ -124,11 +128,15 @@ sub calc_recur {
 
         my $quantity = $cust_pkg->quantity || 1;
 
-        #option to not fallback? via options above
-        my $pkg_setup_fee  =
-          $part_pkg->setup_cost || $part_pkg->option('setup_fee');
-        my $pkg_base_recur =
-          $part_pkg->recur_cost || $part_pkg->base_recur_permonth($cust_pkg);
+        my $pkg_setup_fee  = $part_pkg->setup_cost;
+        $pkg_setup_fee ||= $part_pkg->option('setup_fee')
+          unless $self->option('cost_only');
+        $pkg_setup_fee ||= 0;
+
+        my $pkg_base_recur = $part_pkg->recur_cost;
+        $pkg_base_recur ||= $part_pkg->base_recur_permonth($cust_pkg)
+          unless $self->option('cost_only');
+        $pkg_base_recur ||= 0;
 
         my $pkg_start = $cust_pkg->get('setup');
         if ( $pkg_start < $last_bill ) {

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

Summary of changes:
 FS/FS/part_pkg/agent.pm |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list