select a date when importing credits, RT#27087
authorIvan Kohler <ivan@freeside.biz>
Sat, 25 Jan 2014 02:34:38 +0000 (18:34 -0800)
committerIvan Kohler <ivan@freeside.biz>
Sat, 25 Jan 2014 02:34:38 +0000 (18:34 -0800)
FS/FS/cust_credit.pm
httemplate/misc/cust_credit-import.html
httemplate/misc/process/cust_credit-import.cgi

index 3f8d57c..7ae6c97 100644 (file)
@@ -1118,7 +1118,7 @@ sub process_batch_import {
   my $job = shift;
 
   my $opt = { 'table'   => 'cust_credit',
-              'params'  => [ 'credbatch' ],
+              'params'  => [ '_date', 'credbatch' ],
               'formats' => { 'simple' =>
                                [ 'custnum', 'amount', 'reasonnum', 'invnum' ],
                            },
index 6de34e3..9a63a04 100644 (file)
@@ -7,7 +7,7 @@ Import a file containing credits.
      'name'      => 'CreditImportForm',
      'action'    => 'process/cust_credit-import.cgi',
      'num_files' => 1,
-     'fields'    => [ 'format', 'credbatch' ],
+     'fields'    => [ 'format', '_date', 'credbatch' ],
      'message'   => 'Credit import successful',
      'url'       => $p."search/cust_credit.html?credbatch=$credbatch",
      'onsubmit'  => "document.CreditImportForm.submitButton.disabled=true;",
@@ -18,6 +18,13 @@ Import a file containing credits.
 
   <INPUT TYPE="hidden" NAME="credbatch" VALUE="<% $credbatch %>"%>
 
+  <& /elements/tr-input-date-field.html, {
+       'name'  => '_date',
+       #'value' => '',
+       'label' => 'Date',
+     }
+  &>
+
   <!--
   <TR>
     <TH ALIGN="right">Format</TH>
index 5a5cfe2..4c4d42d 100644 (file)
@@ -4,6 +4,11 @@
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Import');
 
+my %arg = $cgi->param('arg');
+$arg{_date} = parse_datetime( $arg{_date} )
+  if $arg{_date} && $arg{_date} =~ /\D/;
+$cgi->param('arg', %arg );
+
 my $server =
   new FS::UI::Web::JSRPC 'FS::cust_credit::process_batch_import', $cgi;