1 package FS::part_event::Action::cust_bill_send_with_notice;
4 use base qw( FS::part_event::Action );
8 sub description { 'Email a notice to the customer with invoice attached'; }
10 sub eventtable_hashref {
16 'cust_pay_batch' => 1,
17 'cust_statement' => 1,
24 'msgnum' => { label => 'Message template',
25 type => 'select-table',
26 table => 'msg_template',
27 hashref => { disabled => '' },
28 name_col => 'msgname',
31 'modenum' => { label => 'Invoice mode',
32 type => 'select-invoice_mode',
38 sub default_weight { 56; }
41 my( $self, $cust_bill, $cust_event ) = @_;
43 $cust_bill->set('mode' => $self->option('modenum'));
44 my %args = ( 'time' => $cust_event->_date );
45 my $mimepart = MIME::Entity->build( $cust_bill->mimebuild_pdf(\%args) );
46 my $msgnum = $self->option('msgnum');
47 my $msg_template = FS::msg_template->by_key($msgnum)
48 or die "can't find message template #$msgnum to send with invoice";
50 'cust_main' => $cust_bill->cust_main,
51 'object' => $cust_bill,