X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcontact.pm;h=9775e7f6b3fb77f69785f1c3d03bbf941cf21d14;hb=121510b6337b7f75f25d583730a65f3fc63bbfbe;hp=f59fef927b07de39facb11cdba64e74d100201b3;hpb=438c813bf5a71dc6c09396acac85656b15139adf;p=freeside.git diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index f59fef927..9775e7f6b 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -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 @@ -468,6 +469,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);