[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.21,1.22

Jeff Finucane,420,, jeff at wavetail.420.am
Fri Aug 8 11:13:07 PDT 2008


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

Modified Files:
	voip_cdr.pm 
Log Message:
cdrs can be in separate invoice section, after total, summarized inline, with hints for page breaks

Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- voip_cdr.pm	6 Aug 2008 06:39:22 -0000	1.21
+++ voip_cdr.pm	8 Aug 2008 18:13:05 -0000	1.22
@@ -89,6 +89,13 @@
                           'type' => 'checkbox',
                         },
 
+    'usage_section' => { 'name' => 'Section in which to place separate usage charges',
+                       },
+
+    'summarize_usage' => { 'name' => 'Include usage summary with recurring charges when usage is in separate section',
+                          'type' => 'checkbox',
+                        },
+
     #XXX also have option for an external db
 #    'cdr_location' => { 'name' => 'CDR database location'
 #                        'type' => 'select',
@@ -120,7 +127,7 @@
                        disable_src
                        domestic_prefix international_prefix
                        use_amaflags use_disposition output_format
-                       separate_usage
+                       separate_usage summarize_usage usage_section
                      )
                   ],
   'weight' => 40,
@@ -473,7 +480,12 @@
   return []
     unless $charges;  # unless @details?
 
-  my $cust_bill_pkg = new FS::cust_bill_pkg {
+  my @cust_bill_pkg = ();
+
+  my $want_summary = $self->option('summarize_usage', 'Hush!') &&
+                     $self->option('usage_section', 'Hush!');
+
+  push @cust_bill_pkg, new FS::cust_bill_pkg {
     'pkgnum'    => $cust_pkg->pkgnum,
     'setup'     => 0,
     'unitsetup' => 0,
@@ -483,10 +495,27 @@
     'sdate'     => $$sdate,
     'edate'     => $cust_pkg->bill,             # already fiddled
     'itemdesc'  => 'Usage charges',             # configurable?
-    'details'   => \@details,
+    'duplicate' => 'Y',
+  }
+    if $want_summary;
+
+  push @cust_bill_pkg, new FS::cust_bill_pkg {
+    'pkgnum'     => $cust_pkg->pkgnum,
+    'setup'      => 0,
+    'unitsetup ' => 0,
+    'recur'      => sprintf( "%.2f", $charges),  # hmmm
+    'unitrecur ' => 0,
+    'quantity'   => $cust_pkg->quantity,
+    'sdate'      => $$sdate,
+    'edate'      => $cust_pkg->bill,             # already fiddled
+    'itemdesc'   => 'Usage charges',             # configurable?
+    'section'    => $self->option('usage_section', 'Hush!'),
+    'details'    => \@details,
+    'post_total' => ( $want_summary ? 'Y' : '' ),
   };
 
-  return [ $cust_bill_pkg ];
+
+  return [ @cust_bill_pkg ];
 }
 
 1;



More information about the freeside-commits mailing list