aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/PopulateServiceList.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r--perllib/Open311/PopulateServiceList.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index ce5e678c0..c232c4336 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -61,10 +61,12 @@ sub process_services {
my $self = shift;
my $list = shift;
+ $self->found_contacts( [] );
foreach my $service ( @{ $list->{service} } ) {
$self->_current_service( $service );
$self->process_service;
}
+ $self->_delete_contacts_not_in_service_list;
}
sub process_service {
@@ -100,7 +102,7 @@ sub _handle_existing_contact {
print $self->_current_council->area_id . " already has a contact for service code " . $self->_current_service->{service_code} . "\n";
push @{ $self->found_contacts }, $self->_current_service->{service_code};
- if ( $contact->deleted || $service_name ne $contact->category ) {
+ if ( $contact->deleted || $service_name ne $contact->category || $self->_current_service->{service_code} ne $contact->email ) {
$contact->update(
{
category => $service_name,