aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Council.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
committerStruan Donald <struan@exo.org.uk>2012-08-22 10:57:10 +0100
commit2e0a4e8ec45579e4e5c9cf8aa123d5ab215b9703 (patch)
treec13e3c59b686e01460dc7960547f7e9c53c288bd /perllib/FixMyStreet/App/Controller/Council.pm
parentb99c5ff97b29a27eeba52ed24385ac30388e875c (diff)
parent88a7d38dffa3dabdf0f85573b254cea9c8ab232b (diff)
Merge remote-tracking branch 'origin/master' into fmb-read-only
Conflicts: .gitignore bin/make_css conf/general.yml-example perllib/FixMyStreet/App/Controller/Council.pm perllib/FixMyStreet/App/Controller/Report/New.pm perllib/FixMyStreet/Cobrand/Default.pm templates/web/default/around/around_index.html templates/web/default/index.html templates/web/emptyhomes/index.html templates/web/fixmystreet/around/around_index.html templates/web/fixmystreet/index.html web/fixmystreet_app_cgi.cgi web/fixmystreet_app_fastcgi.cgi
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Council.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Council.pm23
1 files changed, 13 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm
index 7a0f9b73f..a6ce533e4 100644
--- a/perllib/FixMyStreet/App/Controller/Council.pm
+++ b/perllib/FixMyStreet/App/Controller/Council.pm
@@ -23,8 +23,8 @@ there are no councils then return false.
sub load_and_check_councils_and_wards : Private {
my ( $self, $c ) = @_;
- my @area_types = ( $c->cobrand->area_types(), @$mySociety::VotingArea::council_child_types );
- $c->stash->{area_types} = \@area_types;
+ my $area_types = [ @{$c->cobrand->area_types}, @{$c->cobrand->area_types_children} ];
+ $c->stash->{area_types} = $area_types;
$c->forward('load_and_check_councils');
}
@@ -42,11 +42,11 @@ sub load_and_check_councils : Private {
my $longitude = $c->stash->{longitude};
# Look up councils and do checks for the point we've got
- my @area_types;
+ my $area_types;
if ( $c->stash->{area_types} and scalar @{ $c->stash->{area_types} } ) {
- @area_types = @{ $c->stash->{area_types} };
+ $area_types = $c->stash->{area_types};
} else {
- @area_types = $c->cobrand->area_types();
+ $area_types = $c->cobrand->area_types;
}
my $short_latitude = Utils::truncate_coordinate($latitude);
@@ -55,7 +55,7 @@ sub load_and_check_councils : Private {
# TODO: I think we want in_gb_locale around the MaPit line, needs testing
my $all_councils;
if ( $c->stash->{fetch_all_areas} ) {
- my %area_types = map { $_ => 1 } @area_types;
+ my %area_types = map { $_ => 1 } @$area_types;
my $all_areas =
mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude" );
$c->stash->{all_areas} = $all_areas;
@@ -67,7 +67,11 @@ sub load_and_check_councils : Private {
} else {
$all_councils =
mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude",
- type => \@area_types );
+ type => $area_types );
+ }
+ if ($all_councils->{error}) {
+ $c->stash->{location_error} = $all_councils->{error};
+ return;
}
# Let cobrand do a check
@@ -83,9 +87,8 @@ sub load_and_check_councils : Private {
$c->cobrand->remove_redundant_councils($all_councils) if $c->stash->{remove_redundant_councils};
# If we don't have any councils we can't accept the report
- if ( !scalar keys %$all_councils || $all_councils->{error}) {
- $c->stash->{location_offshore} = 1;
- $c->stash->{location_error} = 'That point is outside the boundaries.';
+ if ( !scalar keys %$all_councils ) {
+ $c->stash->{location_error} = _('That location does not appear to be covered by a council; perhaps it is offshore or outside the country. Please try again.');
return;
}