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

Ivan,,, ivan at wavetail.420.am
Thu Jun 9 20:33:59 PDT 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	Billing.pm 
Log Message:
add package def option to show $0 recurring on invoices, RT#9777

Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.18.2.8
retrieving revision 1.18.2.9
diff -u -w -d -r1.18.2.8 -r1.18.2.9
--- Billing.pm	6 May 2011 00:29:28 -0000	1.18.2.8
+++ Billing.pm	10 Jun 2011 03:33:57 -0000	1.18.2.9
@@ -580,27 +580,47 @@
 
 #discard bundled packages of 0 value
 sub _omit_zero_value_bundles {
+  my @in = @_;
 
   my @cust_bill_pkg = ();
   my @cust_bill_pkg_bundle = ();
   my $sum = 0;
   my $discount_show_always = 0;
 
-  foreach my $cust_bill_pkg ( @_ ) {
+  foreach my $cust_bill_pkg ( @in ) {
+
     $discount_show_always = ($cust_bill_pkg->get('discounts')
 				&& scalar(@{$cust_bill_pkg->get('discounts')})
 				&& $conf->exists('discount-show-always'));
+
+    warn "  pkgnum ". $cust_bill_pkg->pkgnum.
+         " sum $sum, recur_show_zero ". $cust_bill_pkg->recur_show_zero. "\n"
+      if $DEBUG > 0;
+
     if (scalar(@cust_bill_pkg_bundle) && !$cust_bill_pkg->pkgpart_override) {
       push @cust_bill_pkg, @cust_bill_pkg_bundle 
-			if ($sum > 0 || ($sum == 0 && $discount_show_always));
+        if $sum > 0
+        || ($sum == 0 && (    $discount_show_always
+                           || grep $_->recur_show_zero, @cust_bill_pkg_bundle )
+           );
       @cust_bill_pkg_bundle = ();
       $sum = 0;
     }
+
     $sum += $cust_bill_pkg->setup + $cust_bill_pkg->recur;
     push @cust_bill_pkg_bundle, $cust_bill_pkg;
+
   }
+
   push @cust_bill_pkg, @cust_bill_pkg_bundle
-			if ($sum > 0 || ($sum == 0 && $discount_show_always));
+    if $sum > 0
+    || ($sum == 0 && (    $discount_show_always
+                       || grep $_->recur_show_zero, @cust_bill_pkg_bundle )
+       );
+
+  warn "  _omit_zero_value_bundles: ". scalar(@in).
+       '->'. scalar(@cust_bill_pkg). "\n" #. Dumper(@cust_bill_pkg). "\n"
+    if $DEBUG > 2;
 
   (@cust_bill_pkg);
 
@@ -987,10 +1007,12 @@
     my $discount_show_always = ($recur == 0 && scalar(@discounts) 
 				&& $conf->exists('discount-show-always'));
 
-    if ( $setup != 0 ||
-         $recur != 0 ||
-         (!$part_pkg->hidden && $options{has_hidden}) || #include some $0 lines
-	 $discount_show_always ) 
+    if (    $setup != 0
+         || $recur != 0
+         || (!$part_pkg->hidden && $options{has_hidden}) #include some $0 lines
+         || $discount_show_always
+         || ($recur == 0 && $part_pkg->recur_show_zero)
+       ) 
     {
 
       warn "    charges (setup=$setup, recur=$recur); adding line items\n"



More information about the freeside-commits mailing list