RT# 79352 - keep original email if all new emails are attached to other contacts...
authorChristopher Burger <burgerc@freeside.biz>
Tue, 22 Jan 2019 15:59:45 +0000 (10:59 -0500)
committerChristopher Burger <burgerc@freeside.biz>
Tue, 22 Jan 2019 16:08:00 +0000 (11:08 -0500)
FS/FS/contact.pm

index c024232..5c7e29e 100644 (file)
@@ -468,6 +468,13 @@ sub replace {
 
     }
 
+    ## were all emails duplicates?  if so reset original emails
+    if (scalar @contact_emails < 1 && scalar (keys %contact_nums) > 1) {
+      foreach (qsearch('contact_email', {'contactnum' => $self->contactnum})) {
+        push @contact_emails, $_->emailaddress;
+      }
+    }
+
     my $emails = join(' , ', @contact_emails);
     $self->emailaddress($emails);