[freeside-commits] branch FREESIDE_3_BRANCH updated. da0d59f239e7116893cf3249792e7c572bc8bf84

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


The branch, FREESIDE_3_BRANCH has been updated
       via  da0d59f239e7116893cf3249792e7c572bc8bf84 (commit)
      from  359a6c266813ba42ae534a900da36c5885984207 (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 da0d59f239e7116893cf3249792e7c572bc8bf84
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Dec 12 18:37:49 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 bb8a26d..a4df577 100644
--- a/FS/FS/part_pkg/agent.pm
+++ b/FS/FS/part_pkg/agent.pm
@@ -43,6 +43,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 ) ],
@@ -127,11 +131,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