[freeside-commits] branch FREESIDE_3_BRANCH updated. a4b5a3e0da1e747e5937be1cc69841158743f8a9

Jonathan Prykop jonathan at 420.am
Mon Mar 9 19:12:15 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  a4b5a3e0da1e747e5937be1cc69841158743f8a9 (commit)
      from  5edf8d52173c8579a1d7baf14ca548aa39e211c8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a4b5a3e0da1e747e5937be1cc69841158743f8a9
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Mar 4 21:29:30 2015 -0600

    RT#30825 Modernize Bulk payment importing [fixed format handling]

diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index fae94c3..d2de5f8 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1179,8 +1179,6 @@ sub process_upgrade_paybatch {
 sub process_batch_import {
   my $job = shift;
 
-  #agent_custid isn't a cust_pay field, see hash callback
-  my $format = [ qw(custnum agent_custid paid payinfo invnum) ];
   my $hashcb = sub {
     my %hash = @_;
     my $custnum = $hash{'custnum'};
@@ -1234,19 +1232,11 @@ sub process_batch_import {
 
   my $opt = { 'table'   => 'cust_pay',
               'params'  => [ '_date', 'agentnum', 'payby', 'paybatch' ],
-              'formats' => {
-                'simple-csv' => $format,
-                'simple-xls' => $format,
-              },
-              'format_types' => {
-                'simple-csv' => 'csv',
-                'simple-xls' => 'xls',
-              },
-              'default_csv' => 1,
-              'format_hash_callbacks' => { 
-                'simple-csv' => $hashcb,
-                'simple-xls' => $hashcb,
-              },
+                                         #agent_custid isn't a cust_pay field, see hash callback
+              'formats' => { 'simple' => [ qw(custnum agent_custid paid payinfo invnum) ] },
+              'format_types' => { 'simple' => '' }, #force infer from file extension
+              'default_csv' => 1, #if it's not .xls, it'll read as csv, regardless of extension
+              'format_hash_callbacks' => { 'simple' => $hashcb },
               'postinsert_callback' => sub {
                  my $cust_pay = shift;
                  my $cust_main = $cust_pay->cust_main ||
diff --git a/httemplate/misc/cust_pay-import.cgi b/httemplate/misc/cust_pay-import.cgi
index 102f842..bc4ac83 100644
--- a/httemplate/misc/cust_pay-import.cgi
+++ b/httemplate/misc/cust_pay-import.cgi
@@ -33,8 +33,7 @@ Import a file containing customer payments.
   <TH ALIGN="right">Format</TH>
   <TD>
     <SELECT NAME="format">
-      <OPTION VALUE="simple-csv">Comma-separated (.csv)</OPTION>
-      <OPTION VALUE="simple-xls">Excel (.xls)</OPTION>
+      <OPTION VALUE="simple">Simple</OPTION>
     </SELECT>
   </TD>
 </TR>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_pay.pm                   |   20 +++++---------------
 httemplate/misc/cust_pay-import.cgi |    3 +--
 2 files changed, 6 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list