aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Buckinghamshire.pm23
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm2
3 files changed, 13 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
index c910756cc..1ea87d290 100644
--- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
@@ -89,21 +89,18 @@ 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) = @_;
+sub open311_post_send {
+ my ($self, $row, $h) = @_;
+ # Check Open311 was successful
+ return unless $row->external_id;
+
+ # For Flytipping, send an email also
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, 5);
- if ($site_code) {
- my $e = join('', 'crmbusinesssupport', '@', $self->admin_user_domain);
- push @{$hdrs->{To}}, [ $e, 'TfB' ];
- }
+ my $e = join('', 'illegaldumpingcosts', '@', $self->admin_user_domain);
+ my $sender = FixMyStreet::SendReport::Email->new( to => [ [ $e, 'TfB' ] ] );
+ $sender->send($row, $h);
}
sub map_type { 'Buckinghamshire' }
@@ -334,7 +331,7 @@ sub categories_restriction {
my ($self, $rs) = @_;
# Buckinghamshire is a two-tier council, but only want to display
# county-level categories on their cobrand.
- return $rs->search( { 'body_areas.area_id' => 2217 }, { join => { body => 'body_areas' } });
+ return $rs->search( [ { 'body_areas.area_id' => 2217 }, { category => 'Flytipping' } ], { join => { body => 'body_areas' } });
}
sub lookup_site_code {
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index 079f8ba68..4307694a1 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -57,7 +57,7 @@ sub send {
my $self = shift;
my ( $row, $h ) = @_;
- my $recips = $self->build_recipient_list( $row, $h );
+ my $recips = @{$self->to} ? 1 : $self->build_recipient_list( $row, $h );
# on a staging server send emails to ourselves rather than the bodies
if (FixMyStreet->staging_flag('send_reports', 0) && !FixMyStreet->test_mode) {
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index 84aa851ed..ed71d153b 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -94,6 +94,8 @@ sub send {
$self->error( "Failed to send over Open311\n" ) unless $self->error;
$self->error( $self->error . "\n" . $open311->error );
}
+
+ $cobrand->call_hook(open311_post_send => $row, $h);
}