default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / FS / part_event / Action / cust_bill_email.pm
1 package FS::part_event::Action::cust_bill_email;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5
6 sub description { 'Send invoice (email only)'; }
7
8 ## declaring that this action will send out an invoice
9 sub will_send_invoice { 1; }
10
11 sub eventtable_hashref {
12   { 'cust_bill' => 1 };
13 }
14
15 sub option_fields {
16   (
17     'modenum' => {  label => 'Invoice mode',
18                     type  => 'select-invoice_mode',
19                  },
20   );
21 }
22
23 sub default_weight { 51; }
24
25 sub do_action {
26   my( $self, $cust_bill, $cust_event ) = @_;
27
28   my $cust_main = $cust_bill->cust_main;
29
30   $cust_bill->set('mode' => $self->option('modenum'));
31   if ( $cust_main->invoice_noemail ) {
32     # what about if the customer has no email dest?
33     $cust_event->set('no_action', 'Y');
34     return "customer has invoice_noemail flag";
35   } else {
36     $cust_bill->email;
37   }
38 }
39
40 1;