[freeside-commits] freeside/FS/FS cust_bill.pm, 1.257, 1.258 cust_main.pm, 1.457, 1.458

Jeff Finucane,420,, jeff at wavetail.420.am
Sun Oct 4 18:00:34 PDT 2009


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

Modified Files:
	cust_bill.pm cust_main.pm 
Log Message:
invoices with details in separate section but usage not separated

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.257
retrieving revision 1.258
diff -u -d -r1.257 -r1.258
--- cust_bill.pm	5 Oct 2009 00:49:33 -0000	1.257
+++ cust_bill.pm	5 Oct 2009 01:00:32 -0000	1.258
@@ -3179,7 +3179,8 @@
         {
 
           my $is_summary = $display->summary;
-          my $description = $is_summary ? "Usage charges" : $desc;
+          my $description = ($is_summary && $type && $type eq 'U')
+                            ? "Usage charges" : $desc;
 
           unless ( $conf->exists('disable_line_item_date_ranges') ) {
             $description .= " (" . time2str("%x", $cust_bill_pkg->sdate).
@@ -3201,7 +3202,7 @@
             unless $cust_pkg->part_pkg->hide_svc_detail
                 || $cust_bill_pkg->itemdesc
                 || $cust_bill_pkg->hidden
-                || $is_summary;
+                || $is_summary && $type && $type eq 'U';
 
           push @d, $cust_bill_pkg->details(%details_opt)
             unless ($is_summary || $type && $type eq 'R');

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.457
retrieving revision 1.458
diff -u -d -r1.457 -r1.458
--- cust_main.pm	5 Oct 2009 00:49:34 -0000	1.457
+++ cust_main.pm	5 Oct 2009 01:00:32 -0000	1.458
@@ -3147,7 +3147,9 @@
   }
  
   my @display = ();
-  if ( $conf->exists('separate_usage') || $cust_bill_pkg->hidden ) {
+  my $separate = $conf->exists('separate_usage');
+  my $usage_mandate = $cust_pkg->part_pkg->option('usage_mandate', 'Hush!');
+  if ( $separate || $cust_bill_pkg->hidden || $usage_mandate ) {
 
     my $temp_pkg = new FS::cust_pkg { pkgpart => $real_pkgpart };
     my %hash = $cust_bill_pkg->hidden  # maybe for all bill linked?
@@ -3156,18 +3158,28 @@
 
     my $section = $cust_pkg->part_pkg->option('usage_section', 'Hush!');
     my $summary = $cust_pkg->part_pkg->option('summarize_usage', 'Hush!');
-    push @display, new FS::cust_bill_pkg_display { type => 'S', %hash };
-    push @display, new FS::cust_bill_pkg_display { type => 'R', %hash };
+    if ( $separate ) {
+      push @display, new FS::cust_bill_pkg_display { type => 'S', %hash };
+      push @display, new FS::cust_bill_pkg_display { type => 'R', %hash };
+    } else {
+      push @display, new FS::cust_bill_pkg_display
+                       { type => '',
+                         %hash,
+                         ( ( $usage_mandate ) ? ( 'summary' => 'Y' ) : () ),
+                       };
+    }
 
-    if ($section && $summary) {
+    if ($separate && $section && $summary) {
       push @display, new FS::cust_bill_pkg_display { type    => 'U',
                                                      summary => 'Y',
                                                      %hash,
                                                    };
+    }
+    if ($usage_mandate || $section && $summary) {
       $hash{post_total} = 'Y';
     }
 
-    $hash{section} = $section if $conf->exists('separate_usage');
+    $hash{section} = $section if ($separate || $usage_mandate);
     push @display, new FS::cust_bill_pkg_display { type => 'U', %hash };
 
   }



More information about the freeside-commits mailing list