diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-01 10:54:15 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-04 17:50:55 +0100 |
commit | bcfd55500b9e4546a3951079285e85d2e9cf4995 (patch) | |
tree | ee79729d1834cd8a2e4764d3cb57bae13ef08d74 /perllib | |
parent | 98e61f99be442523fdfb38e95d9a8c2132ea0405 (diff) |
[UK] Deal with 2019 local government changes.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index ae1243fdb..cd697fa0f 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -19,6 +19,9 @@ sub build_recipient_list { my ($body_email, $state, $note) = ( $contact->email, $contact->state, $contact->note ); + $body_email = swandt_contact($row->latitude, $row->longitude) + if ($body->areas->{2427} || $body->areas->{2429}) && $body_email eq 'SPECIAL'; + unless ($state eq 'confirmed') { $all_confirmed = 0; $note = 'Body ' . $row->bodies_str . ' deleted' @@ -111,4 +114,21 @@ sub send { return $result; } +# SW&T has different contact addresses depending upon the old district +sub swandt_contact { + my $district = _get_district_for_contact(@_); + my $email; + $email = ['customerservices', 'westsomerset'] if $district == 2427; + $email = ['enquiries', 'tauntondeane'] if $district == 2429; + return join('@', $email->[0], $email->[1] . '.gov.uk'); +} + +sub _get_district_for_contact { + my ( $lat, $lon ) = @_; + my $district = + FixMyStreet::MapIt::call( 'point', "4326/$lon,$lat", type => 'DIS' ); + ($district) = keys %$district; + return $district; +} + 1; |