From 1d66428dcc75a47c02f5cbd567effc567d38951f Mon Sep 17 00:00:00 2001 From: Hakim Cassimally Date: Thu, 16 Oct 2014 08:35:22 +0000 Subject: [Warwickshire]. PopulateServiceList deletion tweak as WCC is (during beta) mixed email (manually updated) and Open311, override the behaviour to delete contacts not returned by service list, to ignore ones that look like email addresses. --- perllib/Open311/PopulateServiceList.pm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index a838d0fdd..c47ab143d 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -44,9 +44,10 @@ sub process_body { my $id = $self->_current_body->id; my $mapit_url = mySociety::Config::get('MAPIT_URL'); my $areas = join( ",", keys %{$self->_current_body->areas} ); - warn "Body $id for areas $areas - $mapit_url/areas/$areas.html - did not return a service list\n" - if $self->verbose >= 1; - warn $open311->error; + if ($self->verbose >= 1) { + warn "Body $id for areas $areas - $mapit_url/areas/$areas.html - did not return a service list\n"; + warn $open311->error; + } return; } $self->process_services( $list ); @@ -248,7 +249,7 @@ sub _add_meta_to_contact { public_anonymity_required email_alerts_requested ) ], - #2242, + #2243, 'Warwickshire County Council' => [qw( external_id easting @@ -296,6 +297,16 @@ sub _delete_contacts_not_in_service_list { } ); + # for Warwickshire, which is mixed Open311 and email, don't delete the email + # addresses + if ($self->_current_body->name eq 'Warwickshire County Council') { + $found_contacts = $found_contacts->search( + { + email => { -not_like => '%@%' } + } + ); + } + $found_contacts->update( { deleted => 1, -- cgit v1.2.3