This commit was generated by cvs2svn to compensate for changes in r5562,
[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
6 sub description {
7   'Upload CSV invoice data to an FTP server';
8 }
9
10 sub deprecated {
11   1;
12 }
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 => ['default', 'billco'],
23                        option_labels => { 'default' => 'Default',
24                                           'billco'  => 'Billco',
25                                         },
26                      },
27     'ftpserver'   => 'FTP server',
28     'ftpusername' => 'FTP username',
29     'ftppassword' => 'FTP password',
30     'ftpdir'      => 'FTP directory',
31   );
32 }
33
34 sub default_weight {
35   50;
36 }
37
38 sub do_action {
39   my( $self, $cust_bill ) = @_;
40
41   #my $cust_main = $self->cust_main($cust_bill);
42   my $cust_main = $cust_bill->cust_main;
43
44   $cust_bill->send_csv(
45     'protocol'   => 'ftp',
46     'server'     => $self->option('ftpserver'),
47     'username'   => $self->option('ftpusername'),
48     'password'   => $self->option('ftppassword'),
49     'dir'        => $self->option('ftpdir'),
50     'format'     => $self->option('ftpformat'),
51   );
52
53   '';
54 }
55
56 1;