[freeside-commits] freeside/FS/FS/cust_main Billing.pm,1.32,1.33

Erik Levinson levinse at wavetail.420.am
Thu May 5 17:30:09 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv32622/FS/FS/cust_main

Modified Files:
	Billing.pm 
Log Message:
discounts on setup fees, part 2 of 2, RT11512

Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -w -d -r1.32 -r1.33
--- Billing.pm	3 May 2011 23:26:08 -0000	1.32
+++ Billing.pm	6 May 2011 00:30:07 -0000	1.33
@@ -842,6 +842,7 @@
 
   my $setup = 0;
   my $unitsetup = 0;
+  my %setup_param = ();
   if (     ! $options{recurring_only}
        and ! $options{cancel}
        and ( $options{'resetup'}
@@ -864,7 +865,7 @@
     unless ( $cust_pkg->waive_setup ) {
         $lineitems++;
 
-        $setup = eval { $cust_pkg->calc_setup( $time, \@details ) };
+        $setup = eval { $cust_pkg->calc_setup( $time, \@details, \%setup_param ) };
         return "$@ running calc_setup for $cust_pkg\n"
           if $@;
 
@@ -925,6 +926,7 @@
                   'real_pkgpart'        => $real_pkgpart,
                   'freq_override'	=> $options{freq_override} || '',
                   'setup_fee'           => 0,
+                  %setup_param,
                 );
 
     my $method = $options{cancel} ? 'calc_cancel' : 'calc_recur';
@@ -967,6 +969,12 @@
       $lineitems++;
     }
 
+    if ( defined $param{'discount_left_setup'} ) {
+        foreach my $discount_setup ( values %{$param{'discount_left_setup'}} ) {
+            $setup -= $discount_setup;
+        }
+    }
+
   }
 
   warn "\$setup is undefined" unless defined($setup);



More information about the freeside-commits mailing list