diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Buckinghamshire.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm index a5e45d5a9..9b4445460 100644 --- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm +++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm @@ -51,6 +51,8 @@ sub pin_colour { return 'yellow'; } +sub admin_user_domain { 'buckscc.gov.uk' } + sub contact_email { my $self = shift; return join( '@', 'fixmystreetbs', 'email.buckscc.gov.uk' ); @@ -87,6 +89,23 @@ sub open311_config { $row->set_extra_fields(@$extra); } +# This provides a similar functionality to open311_config, but for email. +sub munge_sendreport_params { + my ($self, $row, $vars, $hdrs) = @_; + + return unless $row->category eq 'Flytipping'; + + # Reports made via FMS.com or the app probably won't have a site code + # value because we don't display the adopted highways layer on those + # frontends. Instead we'll look up the closest asset from the WFS + # service at the point we're sending the report by email. + my $site_code = $row->get_extra_field_value('site_code') || $self->lookup_site_code($row, 10); + if ($site_code) { + my $e = join('', 'internaltfb', '@', $self->admin_user_domain); + push @{$hdrs->{To}}, [ $e, 'TfB' ]; + } +} + sub map_type { 'Buckinghamshire' } sub default_map_zoom { 3 } @@ -321,8 +340,8 @@ sub categories_restriction { sub lookup_site_code { my $self = shift; my $row = shift; + my $buffer = shift || 200; # metres - my $buffer = 200; # metres my ($x, $y) = $row->local_coords; my ($w, $s, $e, $n) = ($x-$buffer, $y-$buffer, $x+$buffer, $y+$buffer); diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 583aaaa08..079f8ba68 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -72,6 +72,8 @@ sub send { my ($verbose, $nomail) = CronFns::options(); my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->cobrand)->new(); + $cobrand = $cobrand->call_hook(get_body_handler_for_problem => $row) || $cobrand; + my $params = { To => $self->to, }; |