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 ## declaring that this action will send out an invoice
11 sub will_send_invoice { 1; }
13 sub eventtable_hashref {
19 'cust_pay_batch' => 1,
20 'cust_statement' => 1,
27 'msgnum' => { label => 'Message template',
28 type => 'select-table',
29 table => 'msg_template',
30 hashref => { disabled => '' },
31 name_col => 'msgname',
34 'modenum' => { label => 'Invoice mode',
35 type => 'select-invoice_mode',
41 sub default_weight { 56; }
44 my( $self, $cust_bill, $cust_event ) = @_;
46 $cust_bill->set('mode' => $self->option('modenum'));
47 my %args = ( 'time' => $cust_event->_date );
48 my $mimepart = MIME::Entity->build( $cust_bill->mimebuild_pdf(\%args) );
49 my $msgnum = $self->option('msgnum');
50 my $msg_template = FS::msg_template->by_key($msgnum)
51 or die "can't find message template #$msgnum to send with invoice";
53 'cust_main' => $cust_bill->cust_main,
54 'object' => $cust_bill,