'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;
- if ( defined($args{'_template'}) && length($args{'_template'})
- && -e "$path/logo_". $args{'_template'}. ".png"
+ if ( defined($args{'template'}) && length($args{'template'})
+ && -e "$path/logo_". $args{'template'}. ".png"
)
{
- $file = "$path/logo_". $args{'_template'}. ".png";
+ $file = "$path/logo_". $args{'template'}. ".png";
} else {
$file = "$path/logo.png";
}
=cut
+sub queueable_send {
+ my %opt = @_;
+
+ my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } )
+ or die "invalid invoice number: " . $opt{invnum};
+
+ 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 {
my $self = shift;
my $template = scalar(@_) ? shift : '';
=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 : '';
s/\\item / <li>/;
s/\\end\{enumerate\}/<\/ol>/;
s/\\textbf\{(.*)\}/<b>$1<\/b>/;
+ s/\\\\\*/ /;
$_;
}
$conf->config_orbase('invoice_latexnotes', $template)