From 5ef60116554ff9dbd01bbb4daa4e1ba098905311 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 22 Jan 2019 10:59:45 -0500 Subject: [PATCH] RT# 79352 - keep original email if all new emails are attached to other contacts on contact replace. --- FS/FS/contact.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index f59fef927..13f07a283 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -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); -- 2.11.0