diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 16 | ||||
-rw-r--r-- | t/cobrand/bexley.t | 4 | ||||
-rw-r--r-- | web/cobrands/bexley/js.js | 4 |
3 files changed, 21 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index b2b2c3146..1b960f206 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -45,6 +45,8 @@ sub open311_get_update_munging { } sub lookup_site_code_config { + my ($self, $property) = @_; + # uncoverable subroutine # uncoverable statement { @@ -52,7 +54,7 @@ sub lookup_site_code_config { url => "https://tilma.mysociety.org/mapserver/bexley", srsname => "urn:ogc:def:crs:EPSG::27700", typename => "Streets", - property => "NSG_REF", + property => $property, accept_feature => sub { 1 } } } @@ -74,17 +76,25 @@ sub open311_config { value => $row->detail }; if (!$row->get_extra_field_value('site_code')) { - if (my $ref = $self->lookup_site_code($row)) { + if (my $ref = $self->lookup_site_code($row, 'NSG_REF')) { push @$extra, { name => 'site_code', value => $ref, description => 'Site code' }; } } } elsif ($contact->email =~ /^Uniform/) { + # Reports made via the app probably won't have a UPRN 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('uprn')) { + if (my $ref = $self->lookup_site_code($row, 'UPRN')) { + push @$extra, { name => 'uprn', description => 'UPRN', value => $ref }; + } + } } 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)) { + if (my $ref = $self->lookup_site_code($row, 'NSG_REF')) { push @$extra, { name => 'NSGRef', description => 'NSG Ref', value => $ref }; } } diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index 6b618762f..5ac0562ea 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -34,6 +34,7 @@ my $body = $mech->create_body_ok(2494, 'London Borough of Bexley', { $mech->create_contact_ok(body_id => $body->id, category => 'Abandoned and untaxed vehicles', email => "ABAN"); $mech->create_contact_ok(body_id => $body->id, category => 'Lamp post', email => "LAMP"); $mech->create_contact_ok(body_id => $body->id, category => 'Parks and open spaces', email => "ConfirmPARK"); +$mech->create_contact_ok(body_id => $body->id, category => 'Flytipping', email => "UniformFLY"); $mech->create_contact_ok(body_id => $body->id, category => 'Dead animal', email => "ANIM"); my $category = $mech->create_contact_ok(body_id => $body->id, category => 'Something dangerous', email => "DANG"); $category->set_extra_metadata(group => 'Danger things'); @@ -83,6 +84,7 @@ FixMyStreet::override_config { extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'No' } }, { category => 'Lamp post', code => 'LAMP', email => 'thirdparty.*another', extra => { 'name' => 'dangerous', description => 'Was it dangerous?', 'value' => 'Yes' } }, + { category => 'Flytipping', code => 'UniformFLY' }, ) { ($report) = $mech->create_problems_for_body(1, $body->id, 'On Road', { category => $test->{category}, cobrand => 'bexley', @@ -100,6 +102,8 @@ FixMyStreet::override_config { is $c->param('service_code'), $test->{code}; if ($test->{code} =~ /Confirm/) { is $c->param('attribute[site_code]'), 'Road ID'; + } elsif ($test->{code} =~ /Uniform/) { + is $c->param('attribute[uprn]'), 'Road ID'; } else { is $c->param('attribute[NSGRef]'), 'Road ID'; } diff --git a/web/cobrands/bexley/js.js b/web/cobrands/bexley/js.js index 10d675b93..a500ebbf3 100644 --- a/web/cobrands/bexley/js.js +++ b/web/cobrands/bexley/js.js @@ -76,6 +76,10 @@ fixmystreet.assets.add(road_defaults, { nearest_radius: 100, usrn: [ { + attribute: 'UPRN', + field: 'uprn' + }, + { attribute: 'NSG_REF', field: 'NSGRef' }, |