save changes to credit card billing address, #940
authorMark Wells <mark@freeside.biz>
Thu, 21 Feb 2013 00:48:48 +0000 (16:48 -0800)
committerMark Wells <mark@freeside.biz>
Thu, 21 Feb 2013 00:48:48 +0000 (16:48 -0800)
httemplate/misc/process/payment.cgi

index 506e266..981614e 100644 (file)
@@ -210,7 +210,15 @@ if ( $cgi->param('save') ) {
     $new->set( 'paycvv' => '');
   }
 
-  $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}};
+  if ( $payby eq 'CARD' ) {
+    my $bill_location = FS::cust_location->new;
+    $bill_location->set( $_ => $cgi->param($_) )
+      foreach @{$payby2fields{$payby}};
+    $new->set('bill_location' => $bill_location);
+    # will do nothing if the fields are all unchanged
+  } else {
+    $new->set( $_ => $cgi->param($_) ) foreach @{$payby2fields{$payby}};
+  }
 
   my $error = $new->replace($cust_main);
   errorpage("payment processed successfully, but error saving info: $error")