RT# 79352 - fixed insert error where new contacts not tied to customer on insert.
authorChristopher Burger <burgerc@freeside.biz>
Wed, 23 Jan 2019 16:18:19 +0000 (11:18 -0500)
committerChristopher Burger <burgerc@freeside.biz>
Wed, 23 Jan 2019 16:18:19 +0000 (11:18 -0500)
FS/FS/contact.pm

index 13f07a2..9775e7f 100644 (file)
@@ -168,7 +168,6 @@ sub insert {
   my $existing_contact = '';
   my @contact_emails = ();
   my %contact_nums = ();
-  $contact_nums{$self->contactnum} = '1' if $self->contactnum;
 
   if ( $self->get('emailaddress') =~ /\S/ ) {
 
@@ -202,6 +201,8 @@ sub insert {
     return $error;
   }
 
+  $contact_nums{$self->contactnum} = '1' if $self->contactnum;
+
   my $cust_contact = '';
   # if $self->custnum was set, then the customer-specific properties
   # (custnum, classnum, invoice_dest, selfservice_access, comment) are in