aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2020-03-26 21:37:55 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-03-31 18:08:07 +0100
commitdc0e1638e2bba9924355a11a49eaf4f3bf9671b8 (patch)
tree65df28e7f4a8af2b8d7d563d37d78eace7b3b5b7
parent1bd47700a1fbb08d29651c9d7e5e62e0d2c06401 (diff)
[Buckinghamshire] Use BoroughEmails role for district emails
-rw-r--r--perllib/FixMyStreet/Cobrand/Buckinghamshire.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
index 07e2fcc11..081628ec4 100644
--- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
@@ -7,6 +7,7 @@ use warnings;
use Moo;
with 'FixMyStreet::Roles::ConfirmOpen311';
with 'FixMyStreet::Roles::ConfirmValidation';
+with 'FixMyStreet::Roles::BoroughEmails';
sub council_area_id { return 2217; }
sub council_area { return 'Buckinghamshire'; }
@@ -438,4 +439,23 @@ sub lookup_site_code_config { {
}
} }
+around 'munge_sendreport_params' => sub {
+ my ($orig, $self, $row, $h, $params) = @_;
+
+ # The district areas don't exist in MapIt past generation 36, so look up
+ # what district this report would have been in and temporarily override
+ # the areas column so BoroughEmails::munge_sendreport_params can do its
+ # thing.
+ my ($lat, $lon) = ($row->latitude, $row->longitude);
+ my $district = FixMyStreet::MapIt::call( 'point', "4326/$lon,$lat", type => 'DIS', generation => 36 );
+ ($district) = keys %$district;
+
+ my $original_areas = $row->areas;
+ $row->areas(",$district,");
+
+ $self->$orig($row, $h, $params);
+
+ $row->areas($original_areas);
+};
+
1;