fb71a5a394c037351512a582f0f497ae57f23384
[freeside.git] / FS / FS / part_event / Action / cust_bill_send_alternate.pm
1 package FS::part_event::Action::cust_bill_send_alternate;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Send invoice (email/print/fax) with alternate template'; }
7
8 sub eventtable_hashref {
9   { 'cust_bill' => 1 };
10 }
11
12 sub option_fields {
13   (
14     'modenum'      => { label    => 'Invoice mode',
15                         type     => 'select-invoice_mode' },
16     'templatename' => { label    => 'Template',
17                         type     => 'select-invoice_template',
18                       },
19   );
20 }
21
22 sub default_weight { 50; }
23
24 sub do_action {
25   my( $self, $cust_bill ) = @_;
26
27   #my $cust_main = $self->cust_main($cust_bill);
28   my $cust_main = $cust_bill->cust_main;
29
30   $cust_bill->set('mode' => $self->option('modenum'));
31   $cust_bill->send({'template' => $self->option('templatename')});
32 }
33
34 1;