[freeside-commits] branch master updated. b003202d1bd1ddc6717a4429c1f8863ebc27844c

Christopher Burger burgerc at freeside.biz
Fri May 18 08:42:35 PDT 2018


The branch, master has been updated
       via  b003202d1bd1ddc6717a4429c1f8863ebc27844c (commit)
       via  ddcfe66496c323f1f52fdbd00e8babd43249a609 (commit)
      from  b65bbe5e2161ac6dd4e0e8239ccb7249e001639f (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 b003202d1bd1ddc6717a4429c1f8863ebc27844c
Merge: ddcfe6649 b65bbe5e2
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri May 18 11:41:52 2018 -0400

    Merge branch 'master' of ssh://git.freeside.biz/home/git/freeside


commit ddcfe66496c323f1f52fdbd00e8babd43249a609
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 7c9868d7a..3bffa3a59 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3922,6 +3922,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 1577a7f85..dea89cde1 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++;
 

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

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




More information about the freeside-commits mailing list