[freeside-commits] freeside/FS/FS Conf.pm, 1.216, 1.217 cust_bill.pm, 1.185, 1.186

Jeff Finucane,420,, jeff at wavetail.420.am
Fri Feb 29 09:57:40 PST 2008


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

Modified Files:
	Conf.pm cust_bill.pm 
Log Message:
refactor print_*; invoice sections by package class; could still stand some more refactoring

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- Conf.pm	11 Jan 2008 22:53:56 -0000	1.216
+++ Conf.pm	29 Feb 2008 17:57:36 -0000	1.217
@@ -845,6 +845,13 @@
     'select_enum' => [ '', 'Payable upon receipt', 'Net 0', 'Net 10', 'Net 15', 'Net 30', 'Net 45', 'Net 60' ],
   },
 
+  { 
+    'key'         => 'invoice_sections',
+    'section'     => 'billing',
+    'description' => 'Split invoice into sections and label according to package type when enabled.',
+    'type'        => 'checkbox',
+  },
+
   {
     'key'         => 'payment_receipt_email',
     'section'     => 'billing',

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -d -r1.185 -r1.186
--- cust_bill.pm	19 Feb 2008 02:20:29 -0000	1.185
+++ cust_bill.pm	29 Feb 2008 17:57:37 -0000	1.186
@@ -1519,325 +1519,284 @@
 
 =cut
 
-#still some false laziness w/_items stuff (and send_csv)
 sub print_text {
-
   my( $self, $today, $template ) = @_;
-  $today ||= time;
-
-#  my $invnum = $self->invnum;
-  my $cust_main = $self->cust_main;
[...1441 lines suppressed...]
   my @display = scalar(@_)
@@ -2542,8 +2467,16 @@
 
 sub _items_pkg {
   my $self = shift;
-  my @cust_bill_pkg = grep { $_->pkgnum } $self->cust_bill_pkg;
-  $self->_items_cust_bill_pkg(\@cust_bill_pkg, @_);
+  my %options = @_;
+  my $section = delete $options{'section'};
+  my @cust_bill_pkg =
+    grep { $_->pkgnum &&
+           ( defined($section)
+               ? $_->cust_pkg->part_pkg->classname eq $section->{'description'}
+               : 1
+           )
+         } $self->cust_bill_pkg;
+  $self->_items_cust_bill_pkg(\@cust_bill_pkg, %options);
 }
 
 sub _items_tax {



More information about the freeside-commits mailing list