diff options
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/UKCouncils.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 21dd2d455..0e8341d57 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -270,6 +270,19 @@ sub relative_url_for_report { return FixMyStreet->config('BASE_URL'); } +sub problem_state_processed { + my ($self, $comment) = @_; + + my $state = $comment->problem_state || ''; + my $code = $comment->get_extra_metadata('external_status_code') || ''; + + my $cfg = $self->feature('extra_state_mapping'); + + $state = ( $cfg->{$state}->{$code} || $state ) if $cfg->{$state}; + + return $state; +} + sub admin_allow_user { my ( $self, $user ) = @_; return 1 if $user->is_superuser; @@ -329,6 +342,13 @@ sub munge_report_new_contacts { } } +sub open311_extra_data { + my $self = shift; + my $include = $self->call_hook(open311_extra_data_include => @_); + my $exclude = $self->call_hook(open311_extra_data_exclude => @_); + push @$exclude, 'sect_label', 'road_name', 'area_name'; + return ($include, $exclude); +}; =head2 lookup_site_code @@ -392,7 +412,7 @@ sub _fetch_features_url { SRSNAME => $cfg->{srsname}, TYPENAME => $cfg->{typename}, VERSION => "1.1.0", - outputformat => "geojson", + outputformat => $cfg->{outputformat} || "geojson", $cfg->{filter} ? ( Filter => $cfg->{filter} ) : ( BBOX => $cfg->{bbox} ), ); @@ -405,7 +425,7 @@ sub _nearest_feature { # We have a list of features, and we want to find the one closest to the # report location. - my $site_code = ''; + my $chosen = ''; my $nearest; # We shouldn't receive anything aside from these geometry types, but belt and braces. @@ -432,14 +452,14 @@ sub _nearest_feature { for (my $i=0; $i<@$coordinates-1; $i++) { my $distance = $self->_distanceToLine($x, $y, $coordinates->[$i], $coordinates->[$i+1]); if ( !defined $nearest || $distance < $nearest ) { - $site_code = $feature->{properties}->{$cfg->{property}}; + $chosen = $feature; $nearest = $distance; } } } } - return $site_code; + return $cfg->{property} && $chosen ? $chosen->{properties}->{$cfg->{property}} : $chosen; } sub contact_name { |