aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm20
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;