[freeside-commits] branch FREESIDE_4_BRANCH updated. 5c3cf315f8ef9a67810b4ad3e3ba85a7e371823e

Ivan ivan at 420.am
Thu Jun 25 10:33:08 PDT 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  5c3cf315f8ef9a67810b4ad3e3ba85a7e371823e (commit)
      from  a5ecdf25c4dd54652887c5f6726be00ad1a27813 (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 5c3cf315f8ef9a67810b4ad3e3ba85a7e371823e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jun 25 10:33:07 2015 -0700

    padding with lines of all 9999s to blocks of 10 lines, RT#33622

diff --git a/FS/FS/pay_batch/nacha.pm b/FS/FS/pay_batch/nacha.pm
index c8d784d..0361304 100644
--- a/FS/FS/pay_batch/nacha.pm
+++ b/FS/FS/pay_batch/nacha.pm
@@ -174,6 +174,15 @@ $DEBUG = 0;
 
     my $batchnum = substr( ('0'x7). $pay_batch->batchnum, -7);
 
+    my $lines = $batchcount + 4;
+    my $blocks = int($lines/10);
+    my $fill = '';
+
+    if ( my $remainder = $lines % 10 ) {
+      $blocks++;
+      $fill = ("\n".('9'x94))x( 10 - $remainder );
+    }
+
     warn "building Batch & File Control Records\n" if $DEBUG;
 
     ###
@@ -199,12 +208,18 @@ $DEBUG = 0;
 
     '9'.                                 #Record Type Code
     '000001'.                            #Batch Counter (# of batch header recs)
-    sprintf('%06d', $batchcount + 4).    #num of physical blocks on the file..?
+    sprintf('%06d', $blocks).            #num of physical blocks on the file
     sprintf('%08d', $batchcount).        #total # of entry detail and addenda
     $entry_hash.
     sprintf('%012.0f', $batchtotal * 100). #Debit total
     '000000000000'.                      #Credit total
-    ( ' 'x39 )                           #Reserved / blank
+    ( ' 'x39 ).                          #Reserved / blank
+
+    ###
+    # Pad with 9999 records to blocks of 10
+    ###
+
+    $fill
 
   },
 

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

Summary of changes:
 FS/FS/pay_batch/nacha.pm |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list