summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2005-11-01 05:27:22 +0000
committerivan <ivan>2005-11-01 05:27:22 +0000
commitd190275909c4bbcd6f69c6163800765760d27503 (patch)
tree25053db8b72a0b5790ae02a30181f6b423ad1c4b /FS
parent2fa0c10b17335cf02aaa1b65781b09db8f0f3301 (diff)
only send to specific destinations, oops!
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_bill.pm17
1 files changed, 15 insertions, 2 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index f353ea84c..c1724afe6 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -822,13 +822,25 @@ Spools CSV invoice data.
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 @@ sub print_csv {
$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) );
}