=item cust_main
-Customer object (required).
+Customer object
=item object
A string identifying the kind of message this is. Currently can be "invoice",
"receipt", "admin", or null. Expand this list as necessary.
+=item override_content
+
+A string to use as the HTML body; if specified, replaces the entire
+body of the message. This should be used ONLY by L<FS::report_batch> and may
+go away in the future.
+
=back
=cut
my( $self, %opt ) = @_;
my $cust_main = $opt{'cust_main'}; # or die 'cust_main required';
- my $object = $opt{'object'} or die 'object required';
+ my $object = $opt{'object'}; # or die 'object required';
my $hashref = $self->prepare_substitutions(%opt);
warn "$me filling in body template\n" if $DEBUG;
$body = $body_tmpl->fill_in( HASH => $hashref );
+ # override $body if requested
+ if ( $opt{'override_content'} ) {
+ warn "$me overriding template body with requested content" if $DEBUG;
+ $body = $opt{'override_content'};
+ }
+
###
# and email
###
my $env_to = join(', ', @to);
my $cust_msg = FS::cust_msg->new({
- 'custnum' => $cust_main->custnum,
+ 'custnum' => $cust_main ? $cust_main->custnum : '',
'msgnum' => $self->msgnum,
'_date' => $time,
'env_from' => $env_from,