diff options
| author | Christopher Burger <burgerc@freeside.biz> | 2019-01-21 21:37:38 -0500 |
|---|---|---|
| committer | Christopher Burger <burgerc@freeside.biz> | 2019-01-22 11:07:23 -0500 |
| commit | 1595ded97f613dd951072f936c95c88a470de14e (patch) | |
| tree | 2fef0284d19902dcf3a5c093b90c5442b83adc58 | |
| parent | aa42058ce7c389b491de3389e65306dfe1b52894 (diff) | |
RT# 79352 - fixed so contact replace would not add duplicate cust_contacts.
| -rw-r--r-- | FS/FS/contact.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm index b10e43f85..c024232f0 100644 --- a/FS/FS/contact.pm +++ b/FS/FS/contact.pm @@ -449,7 +449,8 @@ sub replace { ## if found, just add that contact to cust_contact with link_hash credentials ## as email can not be tied to two contacts. my @contact_emails = (); - my @contact_nums = ($self->contactnum,); + my %contact_nums = (); + $contact_nums{$self->contactnum} = '1' if $self->contactnum; if ( $self->get('emailaddress') =~ /\S/ ) { foreach my $email ( split(/\s*,\s*/, $self->get('emailaddress') ) ) { @@ -462,7 +463,7 @@ sub replace { push @contact_emails, $email; } else { - push @contact_nums, $contact->contactnum; + $contact_nums{$contact->contactnum} = '1'; } } @@ -488,9 +489,9 @@ sub replace { # fields. if ( $custnum ) { - foreach my $contactnum (@contact_nums) { + foreach my $contactnum (keys %contact_nums) { - my %hash = ( 'contactnum' => $contactnum, #$self->contactnum, + my %hash = ( 'contactnum' => $contactnum, 'custnum' => $custnum, ); my $error; |
