default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / FS / part_event / Action / cust_bill_send_csv_ftp.pm
1 package FS::part_event::Action::cust_bill_send_csv_ftp;
2
3 use strict;
4 use base qw( FS::part_event::Action );
5 use FS::Misc::Invoicing qw( spool_formats );
6
7 sub description { 'Upload CSV invoice data to an FTP server'; }
8
9 sub deprecated { 1; }
10
11 ## declaring that this action will send out an invoice
12 sub will_send_invoice { 1; }
13
14 sub eventtable_hashref {
15   { 'cust_bill' => 1 };
16 }
17
18 sub option_fields {
19   (
20     'ftpformat'   => { label   => 'Format',
21                        type    =>'select',
22                        options => [ spool_formats() ],
23                      },
24     'ftpserver'   => 'FTP server',
25     'ftpusername' => 'FTP username',
26     'ftppassword' => 'FTP password',
27     'ftpdir'      => 'FTP directory',
28   );
29 }
30
31 sub default_weight { 50; }
32
33 sub do_action {
34   my( $self, $cust_bill ) = @_;
35
36   #my $cust_main = $self->cust_main($cust_bill);
37   my $cust_main = $cust_bill->cust_main;
38
39   $cust_bill->send_csv(
40     'protocol'   => 'ftp',
41     'server'     => $self->option('ftpserver'),
42     'username'   => $self->option('ftpusername'),
43     'password'   => $self->option('ftppassword'),
44     'dir'        => $self->option('ftpdir'),
45     'format'     => $self->option('ftpformat'),
46   );
47
48   '';
49 }
50
51 1;