diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Cobrands/Barnet/Util.pm | 14 | ||||
-rw-r--r-- | perllib/Page.pm | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/perllib/Cobrands/Barnet/Util.pm b/perllib/Cobrands/Barnet/Util.pm index 8eed687de..3cc60117f 100644 --- a/perllib/Cobrands/Barnet/Util.pm +++ b/perllib/Cobrands/Barnet/Util.pm @@ -15,6 +15,7 @@ use strict; use Carp; use URI::Escape; use mySociety::Web qw(ent); +use mySociety::VotingArea; sub new { my $class = shift; @@ -63,13 +64,20 @@ sub enter_postcode_text { =item council_check COUNCILS QUERY CONTEXT -Return a boolean indicating whether the councils for the location passed any -extra checks defined by the cobrand ousing data in the query +Return a boolean indicating whether COUNCILS are okay for the location +in the QUERY, and an error message appropriate to the CONTEXT. =cut sub council_check { - my ($self, $councils, $q, $context) = @_; + my ($self, $params, $q, $context) = @_; + my $councils; + if ($params->{all_councils}) { + $councils = $params->{all_councils}; + } elsif ($params->{e}) { + my $parent_types = $mySociety::VotingArea::council_parent_types; + $councils = mySociety::MaPit::call('point', "27700/$params->{e},$params->{n}", type => $parent_types); + } my $council_match = defined $councils->{2489}; if ($council_match) { return 1; diff --git a/perllib/Page.pm b/perllib/Page.pm index fe6a6e8cb..127fad11b 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -918,6 +918,9 @@ sub mapit_check_error { return $location->{error}; } my $island = $location->{coordsyst}; + if (!$island) { + return _("Sorry, that appears to be a Crown dependency postcode, which we don't cover."); + } if ($island eq 'I') { return _("We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region."); } |