RT# 82092 - custom fields now save and fixed so name label is displayed insted of...
[freeside.git] / httemplate / edit / process / cust_main.cgi
index 4b89939..d277e17 100755 (executable)
@@ -62,7 +62,7 @@ if ( $payby ) {
     $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) );
 }
 
-my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') );
+my @invoicing_list = split( /[,\s]+/, $cgi->param('invoicing_list') );
 push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST');
 push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX');
 $cgi->param('invoicing_list', join(',', @invoicing_list) );
@@ -113,6 +113,11 @@ my $new = new FS::cust_main ( {
 
 $new->invoice_noemail( ($cgi->param('invoice_email') eq 'Y') ? '' : 'Y' );
 
+# add any virtual fields to the new cust_main record
+foreach ($new->virtual_fields) {
+  $new->setfield($_, scalar($cgi->param($_)));
+}
+
 if ( $duplicate_of ) {
   # then negate all changes to the customer; the only change we should
   # make is to order a package, if requested
@@ -330,6 +335,7 @@ if ( $new->custnum eq '' or $duplicate_of ) {
      )
   {
     $new->payinfo($old->payinfo);
+    $new->paymask($old->paymask) if ! $new->paymask || $new->paymask =~ /^N\/A/;
 
   } elsif ( $new->payby =~ /^(CHEK|DCHK)$/ && $new->payinfo =~ /xx/ ) {
     #fix for #3085 "edit of customer's routing code only surprisingly causes