only use new statements as payment receipts if the conf file is created
[freeside.git] / FS / FS / cust_bill.pm
index 00de74a..2c0b353 100644 (file)
@@ -735,9 +735,13 @@ sub queueable_send {
   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});
+  my @args = ( $opt{template}, $opt{agentnum} );
+  push @args, $opt{invoice_from}
+    if exists($opt{invoice_from}) && $opt{invoice_from};
 
+  my $error = $self->send( @args );
   die $error if $error;
+
 }
 
 sub send {
@@ -778,6 +782,21 @@ INVOICE_FROM, if specified, overrides the default email invoice From: address.
 
 =cut
 
+sub queueable_email {
+  my %opt = @_;
+
+  my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } )
+    or die "invalid invoice number: " . $opt{invnum};
+
+  my @args = ( $opt{template} );
+  push @args, $opt{invoice_from}
+    if exists($opt{invoice_from}) && $opt{invoice_from};
+
+  my $error = $self->email( @args );
+  die $error if $error;
+
+}
+
 sub email {
   my $self = shift;
   my $template = scalar(@_) ? shift : '';