[freeside-commits] branch FREESIDE_3_BRANCH updated. 46ea5d28eeb304f0fbdcf78143a5a425de56f653

Ivan ivan at 420.am
Tue May 6 06:38:48 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  46ea5d28eeb304f0fbdcf78143a5a425de56f653 (commit)
      from  f9587ba36d31c9992005a359c74c88d703877194 (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 46ea5d28eeb304f0fbdcf78143a5a425de56f653
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue May 6 06:38:45 2014 -0700

    commissions on package margin, RT#24086

diff --git a/FS/FS/part_event/Action/Mixin/credit_pkg.pm b/FS/FS/part_event/Action/Mixin/credit_pkg.pm
index a3c1d6e..e586f85 100644
--- a/FS/FS/part_event/Action/Mixin/credit_pkg.pm
+++ b/FS/FS/part_event/Action/Mixin/credit_pkg.pm
@@ -21,8 +21,8 @@ sub option_fields {
       'type'    => 'select',
       #add additional ways to specify in the package def
       'options' => [qw(
-        base_recur_permonth cust_bill_pkg_recur recur_cost_permonth
-        unit_setup setup_cost
+        base_recur_permonth cust_bill_pkg_recur recur_cost_permonth recur_margin_permonth
+        unit_setup setup_cost setup_margin
       )],
       'labels'  => {
         'base_recur_permonth' => 'Base monthly fee',
@@ -31,6 +31,8 @@ sub option_fields {
         'recur_cost_permonth' => 'Monthly cost',
         'unit_setup'          => 'Setup fee',
         'setup_cost'          => 'Setup cost',
+        'setup_margin'        => 'Setup margin (fee minus cost)',
+        'recur_margin_permonth' => 'Monthly margin (fee minus cost)',
       },
     },
   );
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 198c362..f446aa9 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -1539,6 +1539,28 @@ sub unit_setup {
   $self->option('setup_fee') || 0;
 }
 
+=item setup_margin
+
+unit_setup minus setup_cost
+
+=cut
+
+sub setup_margin {
+  my $self = shift;
+  $self->unit_setup(@_) - $self->setup_cost;
+}
+
+=item recur_margin_permonth
+
+base_recur_permonth minus recur_cost_permonth
+
+=cut
+
+sub recur_margin_permonth {
+  my $self = shift;
+  $self->base_recur_permonth(@_) - $self->recur_cost_permonth(@_);
+}
+
 =item format OPTION DATA
 
 Returns data formatted according to the function 'format' described

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

Summary of changes:
 FS/FS/part_event/Action/Mixin/credit_pkg.pm |    6 ++++--
 FS/FS/part_pkg.pm                           |   22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list