summaryrefslogtreecommitdiff
path: root/FS/FS/Template_Mixin.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-03-31 16:51:19 -0700
committerMark Wells <mark@freeside.biz>2016-03-31 16:51:19 -0700
commit166741cba0f861e264cb4ee5ddccf28b5be0ed05 (patch)
treede6a51673ee145bcb771917e5ce58319296351fd /FS/FS/Template_Mixin.pm
parent6c80350b6c5301cfbd3b9a69e76f4f945ce806f8 (diff)
fix invoice_email_pdf_msgnum template inclusion, #41502, from #21654
Diffstat (limited to 'FS/FS/Template_Mixin.pm')
-rw-r--r--FS/FS/Template_Mixin.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 6974f7d..a82d51d 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2116,13 +2116,22 @@ sub generate_email {
my $msg_template = FS::msg_template->by_key($msgnum)
or die "${tc}email_pdf_msgnum $msgnum not found\n";
- my %prepared = $msg_template->prepare(
+ my $cust_msg = $msg_template->prepare(
cust_main => $self->cust_main,
- object => $self
+ object => $self,
+ msgtype => 'invoice',
);
- @text = split(/(?=\n)/, $prepared{'text_body'});
- $html = $prepared{'html_body'};
+ # XXX hack to make this work in the new cust_msg era; consider replacing
+ # with cust_bill_send_with_notice events.
+ my @parts = $cust_msg->parts;
+ foreach my $part (@parts) { # will only have two parts, normally
+ if ( $part->mime_type eq 'text/plain' ) {
+ @text = @{ $part->body };
+ } elsif ( $part->mime_type eq 'text/html' ) {
+ $html = $part->bodyhandle->as_string;
+ }
+ }
} elsif ( my @note = $conf->config($tc.'email_pdf_note') ) {