[freeside-commits] branch FREESIDE_4_BRANCH updated. 9baab880cb616a2b9bd7812306563e2f13a4880d

Christopher Burger burgerc at freeside.biz
Fri May 18 09:08:04 PDT 2018


The branch, FREESIDE_4_BRANCH has been updated
       via  9baab880cb616a2b9bd7812306563e2f13a4880d (commit)
       via  e96f711e84bba96db24a91a1053e8a48e807b816 (commit)
      from  68e64cd688ba399ed4d86de5e8f710269a39c76d (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 9baab880cb616a2b9bd7812306563e2f13a4880d
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri May 18 11:41:21 2018 -0400

    RT# 77792 - Created method to decide if batch payname should be name on card or personal name or business name.

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index d71ade04e..22d0dcc42 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4080,6 +4080,27 @@ sub name {
   $name;
 }
 
+=item batch_payment_payname
+
+Returns a name string for this customer, either "cust_batch_payment->payname" or "First Last" or "Company,
+based on if a company name exists and is the account being used a business account.
+
+=cut
+
+sub batch_payment_payname {
+  my $self = shift;
+  my $cust_pay_batch = shift;
+  my $name;
+
+  if ($cust_pay_batch->{Hash}->{payby} eq "CARD") { $name = $cust_pay_batch->payname; }
+  else { $name = $self->first .' '. $self->last; }
+
+  $name = $self->company
+    if (($cust_pay_batch->{Hash}->{paytype} eq "Business checking" || $cust_pay_batch->{Hash}->{paytype} eq "Business savings") && $self->company);
+
+  $name;
+}
+
 =item service_contact
 
 Returns the L<FS::contact> object for this customer that has the 'Service'
diff --git a/FS/FS/pay_batch/RBC.pm b/FS/FS/pay_batch/RBC.pm
index 14b9993fc..18a61706e 100644
--- a/FS/FS/pay_batch/RBC.pm
+++ b/FS/FS/pay_batch/RBC.pm
@@ -175,9 +175,7 @@ $name = 'RBC';
     }
 
     ## set custname to business name if business checking or savings account is used otherwise leave as first and last name.
-    my $custname = $cust_pay_batch->cust_main->first . ' ' . $cust_pay_batch->cust_main->last;
-    $custname = $cust_pay_batch->cust_main->company
-      if (($cust_pay_batch->{Hash}->{paytype} eq "Business checking" || $cust_pay_batch->{Hash}->{paytype} eq "Business savings") && $cust_pay_batch->cust_main->company);
+    my $custname = $cust_pay_batch->cust_main->batch_payment_payname($cust_pay_batch);
 
     $i++;
     sprintf("%06u", $i).

commit e96f711e84bba96db24a91a1053e8a48e807b816
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Mon May 14 12:45:48 2018 -0400

    RT# 77792 - fixed RBC format to display company name with business checking or savings is used

diff --git a/FS/FS/pay_batch/RBC.pm b/FS/FS/pay_batch/RBC.pm
index b0136786b..14b9993fc 100644
--- a/FS/FS/pay_batch/RBC.pm
+++ b/FS/FS/pay_batch/RBC.pm
@@ -174,6 +174,11 @@ $name = 'RBC';
       die "invalid branch/routing number '$aba'\n";
     }
 
+    ## set custname to business name if business checking or savings account is used otherwise leave as first and last name.
+    my $custname = $cust_pay_batch->cust_main->first . ' ' . $cust_pay_batch->cust_main->last;
+    $custname = $cust_pay_batch->cust_main->company
+      if (($cust_pay_batch->{Hash}->{paytype} eq "Business checking" || $cust_pay_batch->{Hash}->{paytype} eq "Business savings") && $cust_pay_batch->cust_main->company);
+
     $i++;
     sprintf("%06u", $i).
     'D'.
@@ -189,8 +194,7 @@ $name = 'RBC';
     sprintf("%010.0f",$cust_pay_batch->amount*100).
     '      '.
     time2str("%Y%j", time + 86400).
-    sprintf("%-30.30s", encode('utf8', $cust_pay_batch->cust_main->first . ' ' .
-                     $cust_pay_batch->cust_main->last)).
+    sprintf("%-30.30s", encode('utf8', $custname)).
     'E'. # English
     ' '.
     sprintf("%-15s", $shortname).

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

Summary of changes:
 FS/FS/cust_main.pm     | 21 +++++++++++++++++++++
 FS/FS/pay_batch/RBC.pm |  6 ++++--
 2 files changed, 25 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list