fix for lack of input validation - RT#15405
[freeside.git] / FS / FS / part_event / Action / cust_bill_spool_csv.pm
index 24c26ff..250c830 100644 (file)
@@ -2,7 +2,7 @@ package FS::part_event::Action::cust_bill_spool_csv;
 
 use strict;
 use base qw( FS::part_event::Action );
-use FS::Misc;
+use FS::Misc::Invoicing qw( spool_formats );
 
 sub description { 'Spool CSV invoice data'; }
 
@@ -16,7 +16,7 @@ sub option_fields {
   (
     'spoolformat'       => { label   => 'Format',
                              type    => 'select',
-                             options => [ FS::Misc::spool_formats() ],
+                             options => [ spool_formats() ],
                            },
     'spoolbalanceover'  => { label =>
                                'If balance (this invoice and previous) over',
@@ -26,9 +26,9 @@ sub option_fields {
                              type  => 'checkbox',
                              value => '1',
                            },
-    'ftp_targetnum'     => { label    => 'Upload spool to FTP target',
+    'upload_targetnum'  => { label    => 'Upload spool to target',
                              type     => 'select-table',
-                             table    => 'ftp_target',
+                             table    => 'upload_target',
                              name_col => 'label',
                              empty_label => '(do not upload)',
                              order_by => 'targetnum',
@@ -39,16 +39,17 @@ sub option_fields {
 sub default_weight { 50; }
 
 sub do_action {
-  my( $self, $cust_bill ) = @_;
+  my( $self, $cust_bill, $cust_event ) = @_;
 
   #my $cust_main = $self->cust_main($cust_bill);
   my $cust_main = $cust_bill->cust_main;
 
   $cust_bill->spool_csv(
+    'time'         => $cust_event->_date,
     'format'       => $self->option('spoolformat'),
     'balanceover'  => $self->option('spoolbalanceover'),
     'agent_spools' => $self->option('spoolagent_spools'),
-    'ftp_targetnum'=> $self->option('ftp_targetnum'),
+    'upload_targetnum'=> $self->option('upload_targetnum'),
   );
 }