diff options
author | Struan Donald <struan@exo.org.uk> | 2011-10-11 10:13:47 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-10-11 10:13:47 +0100 |
commit | 7ddcddb27d0a3237e373757cbcc852974312a95a (patch) | |
tree | d8932da6c8c3f7c847af0321c3da7688650c633f /perllib/Open311/PopulateServiceList.pm | |
parent | bd24d2a0365e65cd6b0bc3623f2d7c16a5e4269a (diff) |
test existing contacts are deleted
udpate service code for contact with same category
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 4 |
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, |