56ba680e1689500c1e238392961f132407ed7561
[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 sub eventtable_hashref {
12   { 'cust_bill' => 1 };
13 }
14
15 sub option_fields {
16   (
17     'ftpformat'   => { label   => 'Format',
18                        type    =>'select',
19                        options => [ spool_formats() ],
20                      },
21     'ftpserver'   => 'FTP server',
22     'ftpusername' => 'FTP username',
23     'ftppassword' => 'FTP password',
24     'ftpdir'      => 'FTP directory',
25   );
26 }
27
28 sub default_weight { 50; }
29
30 sub do_action {
31   my( $self, $cust_bill ) = @_;
32
33   #my $cust_main = $self->cust_main($cust_bill);
34   my $cust_main = $cust_bill->cust_main;
35
36   $cust_bill->send_csv(
37     'protocol'   => 'ftp',
38     'server'     => $self->option('ftpserver'),
39     'username'   => $self->option('ftpusername'),
40     'password'   => $self->option('ftppassword'),
41     'dir'        => $self->option('ftpdir'),
42     'format'     => $self->option('ftpformat'),
43   );
44
45   '';
46 }
47
48 1;