diff options
author | Struan Donald <struan@exo.org.uk> | 2011-10-11 12:17:52 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-10-11 12:17:52 +0100 |
commit | 3307cf922cbf0513ef99b874f241350b16a5e67e (patch) | |
tree | fc81181109370ba46e032d1e54b8c49feea195fa /perllib/Open311 | |
parent | 19b9118729a036471759ad1a6519caaf0c3134c5 (diff) |
if we have two conflicting existing contacts then skip the update
Diffstat (limited to 'perllib/Open311')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index 2dfe7e5c4..f490607e4 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -83,8 +83,22 @@ sub process_service { } ); - my $contact = $contacts->first; + if ( $contacts->count() > 1 ) { + sprintf( + "Multiple contacts for service code %s, category %s - Skipping\n", + $self->_current_service->{service_code}, + $self->_current_service->{service_name}, + ); + + # best to not mark them as deleted as we don't know what we're doing + while ( my $contact = $contacts->next ) { + push @{ $self->found_contacts }, $contact->email; + } + return; + } + + my $contact = $contacts->first; if ( $contact ) { $self->_handle_existing_contact( $contact ); |