[freeside-commits] freeside/FS/FS cust_bill.pm,1.137,1.138

Ivan,,, ivan at wavetail.420.am
Mon Oct 31 21:27:24 PST 2005


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv31179

Modified Files:
	cust_bill.pm 
Log Message:
only send to specific destinations, oops!

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- cust_bill.pm	1 Nov 2005 03:15:32 -0000	1.137
+++ cust_bill.pm	1 Nov 2005 05:27:22 -0000	1.138
@@ -822,13 +822,25 @@
 
 Options are:
 
-format - 'default' or 'billco'
+=over 4
+
+=item format - 'default' or 'billco'
+
+=item dest - if set (to POST, EMAIL or FAX), only sends spools invoices if the customer has the corresponding invoice destinations set (see L<FS::cust_main_invoice>).
+
+=back
 
 =cut
 
 sub spool_csv {
   my($self, %opt) = @_;
 
+  if ( $opt{'dest'} ) {
+    my %invoicing_list = map { /^(POST|FAX)$/ or $1 = 'EMAIL'; $1 => 1 }
+                             $self->cust_main->invoicing_list;
+    return unless $invoicing_list{$opt{'dest'}};
+  }
+
   #create file(s)
 
   my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/cust_bill";
@@ -1010,7 +1022,8 @@
     $taxtotal += $_->{'amount'} foreach $self->_items_tax;
 
     my $duedate = '';
-    if ( $conf->config('invoice_default_terms') =~ /^\s*Net\s*(\d+)\s*$/ ) {
+    if (    $conf->exists('invoice_default_terms') 
+         && $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) {
       $duedate = time2str("%m/%d/%Y", $self->_date + ($1*86400) );
     }
 



More information about the freeside-commits mailing list