[freeside-commits] freeside/FS/FS/cust_main Billing.pm, 1.18.2.7, 1.18.2.8

Erik Levinson levinse at wavetail.420.am
Thu May 5 17:29:46 PDT 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	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.18.2.7
retrieving revision 1.18.2.8
diff -u -w -d -r1.18.2.7 -r1.18.2.8
--- Billing.pm	25 Apr 2011 04:37:11 -0000	1.18.2.7
+++ Billing.pm	6 May 2011 00:29:28 -0000	1.18.2.8
@@ -828,6 +828,7 @@
 
   my $setup = 0;
   my $unitsetup = 0;
+  my %setup_param = ();
   if (     ! $options{recurring_only}
        and ! $options{cancel}
        and ( $options{'resetup'}
@@ -850,7 +851,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 $@;
 
@@ -910,6 +911,7 @@
                   'discounts'           => \@discounts,
                   'real_pkgpart'        => $real_pkgpart,
                   'freq_override'	=> $options{freq_override} || '',
+                  %setup_param,
                 );
 
     my $method = $options{cancel} ? 'calc_cancel' : 'calc_recur';
@@ -939,6 +941,12 @@
 
     }
 
+    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