aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/SendReport')
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm25
-rw-r--r--perllib/FixMyStreet/SendReport/Email/Highways.pm13
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm4
3 files changed, 13 insertions, 29 deletions
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index 72cd42952..2d5e85f3e 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -16,9 +16,6 @@ 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->name eq 'Somerset West and Taunton Council' && $body_email eq 'SPECIAL';
-
unless ($state eq 'confirmed') {
$all_confirmed = 0;
$note = 'Body ' . $row->bodies_str . ' deleted'
@@ -56,10 +53,11 @@ sub send_from {
sub envelope_sender {
my ($self, $row) = @_;
+ my $cobrand = $row->get_cobrand_logged;
if ($row->user->email && $row->user->email_verified) {
- return FixMyStreet::Email::unique_verp_id('report', $row->id);
+ return FixMyStreet::Email::unique_verp_id([ 'report', $row->id ], $cobrand->call_hook('verp_email_domain'));
}
- return $row->get_cobrand_logged->do_not_reply_email;
+ return $cobrand->do_not_reply_email;
}
sub send {
@@ -128,21 +126,4 @@ sub email_list {
return \@list;
}
-# 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', generation => 34 );
- ($district) = keys %$district;
- return $district;
-}
-
1;
diff --git a/perllib/FixMyStreet/SendReport/Email/Highways.pm b/perllib/FixMyStreet/SendReport/Email/Highways.pm
index 2bcd120d3..3ace07b6a 100644
--- a/perllib/FixMyStreet/SendReport/Email/Highways.pm
+++ b/perllib/FixMyStreet/SendReport/Email/Highways.pm
@@ -12,11 +12,14 @@ sub build_recipient_list {
my $contact = $self->fetch_category($body, $row) or return;
my $email = $contact->email;
my $area_name = $row->get_extra_field_value('area_name') || '';
- if ($area_name eq 'Area 7') {
- my $a7email = FixMyStreet->config('COBRAND_FEATURES') || {};
- $a7email = $a7email->{open311_email}->{highwaysengland}->{area_seven};
- $email = $a7email if $a7email;
- }
+
+ # config is read-only, so must step through one-by-one to prevent
+ # vivification
+ my $area_email = FixMyStreet->config('COBRAND_FEATURES') || {};
+ $area_email = $area_email->{open311_email} || {};
+ $area_email = $area_email->{highwaysengland} || {};
+ $area_email = $area_email->{$area_name};
+ $email = $area_email if $area_email;
@{$self->to} = map { [ $_, $body->name ] } split /,/, $email;
return 1;
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index e8e840ef5..e51bd76c9 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -41,13 +41,13 @@ sub send {
# Try and fill in some ones that we've been asked for, but not asked the user for
my $extra = $row->get_extra_fields();
- my ($include, $exclude) = $cobrand->call_hook(open311_extra_data => $row, $h, $extra, $contact);
+ my ($include, $exclude) = $cobrand->call_hook(open311_extra_data => $row, $h, $contact);
my $original_extra = [ @$extra ];
push @$extra, @$include if $include;
if ($exclude) {
$exclude = join('|', @$exclude);
- @$extra = grep { $_->{name} !~ /$exclude/ } @$extra;
+ @$extra = grep { $_->{name} !~ /$exclude/i } @$extra;
}
my $id_field = $contact->id_field;