aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm9
-rw-r--r--perllib/Open311.pm11
2 files changed, 17 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index fe99e3043..845a6295c 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -31,6 +31,7 @@ sub send {
my $conf = FixMyStreet::App->model("DB::Open311conf")->search( { area_id => $council, endpoint => { '!=', '' } } )->first;
my $always_send_latlong = 1;
+ my $send_notpinpointed = 0;
my $basic_desc = 0;
@@ -38,8 +39,10 @@ sub send {
if ( $row->council =~ /2482/ ) {
my $extra = $row->extra;
- push @$extra, { name => 'northing', value => $h->{northing} };
- push @$extra, { name => 'easting', value => $h->{easting} };
+ if ( $row->used_map || ( !$row->used_map && !$row->postcode ) ) {
+ push @$extra, { name => 'northing', value => $h->{northing} };
+ push @$extra, { name => 'easting', value => $h->{easting} };
+ }
push @$extra, { name => 'report_url', value => $h->{url} };
push @$extra, { name => 'service_request_id_ext', value => $row->id };
push @$extra, { name => 'report_title', value => $row->title };
@@ -50,6 +53,7 @@ sub send {
$row->extra( $extra );
$always_send_latlong = 0;
+ $send_notpinpointed = 1;
$basic_desc = 1;
}
@@ -66,6 +70,7 @@ sub send {
endpoint => $conf->endpoint,
api_key => $conf->api_key,
always_send_latlong => $always_send_latlong,
+ send_notpinpointed => $send_notpinpointed,
basic_description => $basic_desc,
);
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index 730b71958..0d3c0720d 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -21,6 +21,7 @@ has debug_details => ( is => 'rw', 'isa' => 'Str', default => '' );
has success => ( is => 'rw', 'isa' => 'Bool', default => 0 );
has error => ( is => 'rw', 'isa' => 'Str', default => '' );
has always_send_latlong => ( is => 'ro', isa => 'Bool', default => 1 );
+has send_notpinpointed => ( is => 'ro', isa => 'Bool', default => 0 );
has basic_description => ( is => 'ro', isa => 'Bool', default => 0 );
before [
@@ -105,10 +106,18 @@ sub _populate_service_request_params {
# if you click nearby reports > skip map then it's possible
# to end up with used_map = f and nothing in postcode
if ( $problem->used_map || $self->always_send_latlong
- || ( !$problem->used_map && !$problem->postcode ) )
+ || ( !$self->send_notpinpointed && !$problem->used_map
+ && !$problem->postcode ) )
{
$params->{lat} = $problem->latitude;
$params->{long} = $problem->longitude;
+ # this is a special case for sending to Bromley so they can
+ # report accuracy levels correctly. We include easting and
+ # northing as attributes elsewhere.
+ } elsif ( $self->send_notpinpointed && !$problem->used_map
+ && !$problem->postcode )
+ {
+ $params->{address_id} = '#NOTPINPOINTED#';
} else {
$params->{address_string} = $problem->postcode;
}