[freeside-commits] freeside/FS/FS cust_bill.pm, 1.350.2.13, 1.350.2.14 Conf.pm, 1.468.2.22, 1.468.2.23

Ivan,,, ivan at wavetail.420.am
Mon Nov 28 16:20:13 PST 2011


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

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	cust_bill.pm Conf.pm 
Log Message:
also supress sending invoices w/selfservice-hide_invoices-taxclass, RT#15327

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.468.2.22
retrieving revision 1.468.2.23
diff -u -w -d -r1.468.2.22 -r1.468.2.23
--- Conf.pm	28 Nov 2011 01:40:27 -0000	1.468.2.22
+++ Conf.pm	29 Nov 2011 00:20:11 -0000	1.468.2.23
@@ -2494,7 +2494,7 @@
   {
     'key'         => 'selfservice-hide_invoices-taxclass',
     'section'     => 'self-service',
-    'description' => 'Hide invoices with only this package tax class from self-service.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
+    'description' => 'Hide invoices with only this package tax class from self-service and supress sending (emailing, printing, faxing) them.  Typically set to something like "Previous balance" and used when importing legacy invoices into legacy_cust_bill.',
     'type'        => 'text',
   },
 

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.350.2.13
retrieving revision 1.350.2.14
diff -u -w -d -r1.350.2.13 -r1.350.2.14
--- cust_bill.pm	27 Nov 2011 00:49:39 -0000	1.350.2.13
+++ cust_bill.pm	29 Nov 2011 00:20:10 -0000	1.350.2.14
@@ -796,6 +796,23 @@
   $balance;
 }
 
+=item hide
+
+Returns true if this invoice should be hidden.  See the
+selfservice-hide_invoices-taxclass configuraiton setting.
+
+=cut
+
+sub hide {
+  my $self = shift;
+  my $conf = $self->conf;
+  my $hide_taxclass = $conf->config('selfservice-hide_invoices-taxclass')
+    or return '';
+  my @cust_bill_pkg = $self->cust_bill_pkg;
+  my @part_pkg = grep $_, map $_->part_pkg, @cust_bill_pkg;
+  ! grep { $_->taxclass ne $hide_taxclass } @part_pkg;
+}
+
 =item apply_payments_and_credits [ OPTION => VALUE ... ]
 
 Applies unapplied payments and credits to this invoice.
@@ -1335,6 +1352,7 @@
 #sub email_invoice {
 sub email {
   my $self = shift;
+  return if $self->hide;
   my $conf = $self->conf;
 
   my( $template, $invoice_from, $notice_name, $no_coupon );
@@ -1453,7 +1471,9 @@
 #sub print_invoice {
 sub print {
   my $self = shift;
+  return if $self->hide;
   my $conf = $self->conf;
+
   my( $template, $notice_name );
   if ( ref($_[0]) ) {
     my $opt = shift;
@@ -1493,7 +1513,9 @@
 
 sub fax_invoice {
   my $self = shift;
+  return if $self->hide;
   my $conf = $self->conf;
+
   my( $template, $notice_name );
   if ( ref($_[0]) ) {
     my $opt = shift;



More information about the freeside-commits mailing list