aboutsummaryrefslogtreecommitdiffstats
path: root/bin/open311-populate-service-list
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-07-22 10:26:19 +0100
committerStruan Donald <struan@exo.org.uk>2011-07-22 10:26:19 +0100
commit8d8edcdc8bb67d6bcdbf2c7fe9e7c3bc5f6ba213 (patch)
treeb607151661d54be1ba4af0988a133f8c0cc4d2c4 /bin/open311-populate-service-list
parent0dee26bdeb76a6f4e4444da7cb95b365feb8964d (diff)
undelete existing contacts if required
Diffstat (limited to 'bin/open311-populate-service-list')
-rw-r--r--bin/open311-populate-service-list14
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/open311-populate-service-list b/bin/open311-populate-service-list
index dcdacb047..30a55c178 100644
--- a/bin/open311-populate-service-list
+++ b/bin/open311-populate-service-list
@@ -33,8 +33,22 @@ foreach my $service ( @{ $list->{service} } ) {
my $contact = $contacts->first;
if ( $contact ) {
+
print "$council already has a contact for service code " . $service->{service_code} . "\n";
push @found_contacts, $service->{service_code};
+
+ if ( $contact->deleted ) {
+ $contact->update(
+ {
+ category => $service->{service_name},
+ confirmed => 1,
+ deleted => 0,
+ editor => $0,
+ whenedited => \'ms_current_timestamp()',
+ note => 'automatically undeleted by script',
+ }
+ );
+ }
} else {
my $contact = FixMyStreet::App->model( 'DB::Contact')->create(
{