[freeside-commits] branch FREESIDE_2_3_BRANCH updated. c3c4704ff8c6e3083449880ac4feb9af423d01f0

Mark Wells mark at 420.am
Fri Apr 27 11:53:04 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  c3c4704ff8c6e3083449880ac4feb9af423d01f0 (commit)
      from  cfd239c83c9bfc0d4ff31d9560115d6e6afe1cb3 (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 c3c4704ff8c6e3083449880ac4feb9af423d01f0
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Apr 27 11:52:59 2012 -0700

    don't change service address when selfservice changes billing address, #14613

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index e9394e4..08e3f7e 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -570,6 +570,12 @@ sub edit_info {
     or return { 'error' => "unknown custnum $custnum" };
 
   my $new = new FS::cust_main { $cust_main->hash };
+  # Avoid accidentally changing the service address.
+  if ( !$new->has_ship_address ) {
+    $new->set( $_ => $new->get($_) )
+      foreach $new->addr_fields;
+  }
+
   $new->set( $_ => $p->{$_} )
     foreach grep { exists $p->{$_} } @cust_main_editable_fields;
 
@@ -927,9 +933,17 @@ sub do_process_payment {
     my $new = new FS::cust_main { $cust_main->hash };
     if ($payby eq 'CARD' || $payby eq 'DCRD') {
       $new->set( $_ => $validate->{$_} )
-        foreach qw( payname paystart_month paystart_year payissue payip
-                    address1 address2 city state zip country );
+        foreach qw( payname paystart_month paystart_year payissue payip );
       $new->set( 'payby' => $validate->{'auto'} ? 'CARD' : 'DCRD' );
+
+      # Avoid accidentally changing the service address.
+      if ( !$new->has_ship_address ) {
+        $new->set( "ship_$_" => $new->get($_) ) 
+          foreach $new->addr_fields;
+      }
+      $new->set( $_ => $validate->{$_} )
+        foreach qw(address1 address2 city state country zip);
+
     } elsif ($payby eq 'CHEK' || $payby eq 'DCHK') {
       $new->set( $_ => $validate->{$_} )
         foreach qw( payname payip paytype paystate

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list