X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=1016b80ec547bf83a67579be13e99628d00fc39e;hb=a7ea8cde763b396d0f4ce48168c689d038263786;hp=dc45dc32b71aa770e4fec69dbd8b78519961d634;hpb=811f2540b22045c137b4b8f2b5ff17bf6cbe957c;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index dc45dc32b..1016b80ec 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -571,8 +571,9 @@ sub generate_email { 'Disposition' => 'inline', ); - $args{'from'} =~ /\@([\w\.\-]+)/ or $1 = 'example.com'; - my $content_id = join('.', rand()*(2**32), $$, time). "\@$1"; + $args{'from'} =~ /\@([\w\.\-]+)/; + my $from = $1 || 'example.com'; + my $content_id = join('.', rand()*(2**32), $$, time). "\@$from"; my $path = "$FS::UID::conf_dir/conf.$FS::UID::datasrc"; my $file; @@ -728,6 +729,17 @@ INVOICE_FROM, if specified, overrides the default email invoice From: address. =cut +sub queueable_send { + my %opt = @_; + + my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } ) + or die "invalid invoice number: " . $opt{invnum}; + + my $error = $self->send($opt{template}, $opt{agentnum}, $opt{invoice_from}); + + die $error if $error; +} + sub send { my $self = shift; my $template = scalar(@_) ? shift : '';