diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index 3bb9bf417..767aa661b 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -81,4 +81,32 @@ sub open311_config { $row->set_extra_fields(@$extra); } +sub admin_user_domain { 'bexley.gov.uk' } + +sub open311_post_send { + my ($self, $row, $h) = @_; + + # Check Open311 was successful + return unless $row->external_id; + + return unless $row->category eq 'Abandoned and untaxed vehicles' + || $row->category eq 'Animal fouling'; + + my $mb = FixMyStreet->config('STAGING_SITE') ? 'digital-team' : 'P1sfromContactCentre'; + my $e = join('@', $mb, $self->admin_user_domain); + my $sender = FixMyStreet::SendReport::Email->new( to => [ [ $e, 'Bexley P1 email' ] ] ); + + if ($row->category eq 'Abandoned and untaxed vehicles') { + my ($burnt) = grep { $_->{name} eq 'burnt' } @{$row->get_extra_fields}; + return unless $burnt && $burnt->{value} eq 'Yes'; + } + + $self->open311_config($row); # Populate NSGRef again if needed + + my $extra_data = join "; ", map { "$_->{description}: $_->{value}" } @{$row->get_extra_fields}; + $h->{additional_information} = $extra_data; + + $sender->send($row, $h); +} + 1; |