diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 37 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Open311.pm | 8 |
2 files changed, 32 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index 1a303d633..eda276add 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -58,16 +58,35 @@ sub lookup_site_code_config { } sub open311_config { - my ($self, $row, $h, $params) = @_; + my ($self, $row, $h, $params, $contact) = @_; + + $params->{multi_photos} = 1; my $extra = $row->get_extra_fields; - # Reports made via the app probably won't have a NSGRef because we don't - # display the road layer. Instead we'll look up the closest asset from the - # WFS service at the point we're sending the report over Open311. - if (!$row->get_extra_field_value('NSGRef')) { - if (my $ref = $self->lookup_site_code($row)) { - push @$extra, { name => 'NSGRef', description => 'NSG Ref', value => $ref }; + if ($contact->email =~ /^Confirm/) { + push @$extra, + { name => 'report_url', description => 'Report URL', + value => $h->{url} }, + { name => 'title', description => 'Title', + value => $row->title }, + { name => 'description', description => 'Detail', + value => $row->detail }; + + if (!$row->get_extra_field_value('site_code')) { + if (my $ref = $self->lookup_site_code($row)) { + push @$extra, { name => 'site_code', value => $ref, description => 'Site code' }; + } + } + } elsif ($contact->email =~ /^Uniform/) { + } else { # Symology + # Reports made via the app probably won't have a NSGRef because we don't + # display the road layer. Instead we'll look up the closest asset from the + # WFS service at the point we're sending the report over Open311. + if (!$row->get_extra_field_value('NSGRef')) { + if (my $ref = $self->lookup_site_code($row)) { + push @$extra, { name => 'NSGRef', description => 'NSG Ref', value => $ref }; + } } } @@ -77,7 +96,7 @@ sub open311_config { sub admin_user_domain { 'bexley.gov.uk' } sub open311_post_send { - my ($self, $row, $h) = @_; + my ($self, $row, $h, $contact) = @_; # Check Open311 was successful return unless $row->external_id; @@ -122,7 +141,7 @@ sub open311_post_send { return unless @to; my $sender = FixMyStreet::SendReport::Email->new( to => \@to ); - $self->open311_config($row); # Populate NSGRef again if needed + $self->open311_config($row, $h, {}, $contact); # Populate NSGRef again if needed my $extra_data = join "; ", map { "$_->{description}: $_->{value}" } @{$row->get_extra_fields}; $h->{additional_information} = $extra_data; diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index fcb6f7298..c4532e3b3 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -34,11 +34,11 @@ sub send { fixmystreet_body => $body, ); - my $cobrand = $body->get_cobrand_handler || $row->get_cobrand_logged; - $cobrand->call_hook(open311_config => $row, $h, \%open311_params); - my $contact = $self->fetch_category($body, $row) or next; + my $cobrand = $body->get_cobrand_handler || $row->get_cobrand_logged; + $cobrand->call_hook(open311_config => $row, $h, \%open311_params, $contact); + # Try and fill in some ones that we've been asked for, but not asked the user for my $extra = $row->get_extra_fields(); @@ -94,7 +94,7 @@ sub send { $self->error( $self->error . "\n" . $open311->error ); } - $cobrand->call_hook(open311_post_send => $row, $h); + $cobrand->call_hook(open311_post_send => $row, $h, $contact); } |