diff options
author | Struan Donald <struan@exo.org.uk> | 2011-05-19 12:56:27 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-05-19 12:56:27 +0100 |
commit | 19f27c24d9dbe6f83a6778f949a35f73514f73b6 (patch) | |
tree | fb34a44726891ddf8e2d9db6ad6e7eaf3d01f0a7 /perllib/FixMyStreet/Cobrand/Default.pm | |
parent | 109b706b68d85708dd023faedd8065efc3839a85 (diff) | |
parent | d44c6e58d1efe505006a38a62b61b1045031dd49 (diff) |
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Default.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index e3c5ed821..7920a15d6 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -6,6 +6,7 @@ use FixMyStreet; use URI; use Carp; +use mySociety::MaPit; =head2 new @@ -111,7 +112,7 @@ empty string and site key 0 if the cobrand uses all the data. =cut -sub site_restriction { return ( "", 0 ) } +sub site_restriction { return ( "", 0, {} ) } =head2 contact_restriction @@ -793,5 +794,24 @@ sub generate_problem_banner { return $banner; } + +sub reports_council_check { + my ( $self, $c, $code ) = @_; + + if ($code =~ /^(\d\d)([a-z]{2})?([a-z]{2})?$/i) { + my $area = mySociety::MaPit::call( 'area', uc $code ); + $c->detach( 'redirect_index' ) if $area->{error}; # Given a bad/old ONS code + if (length($code) == 6) { + my $council = mySociety::MaPit::call( 'area', $area->{parent_area} ); + $c->stash->{ward} = $area; + $c->stash->{council} = $council; + $c->detach( 'redirect_ward' ); + } else { + $c->stash->{council} = $area; + $c->detach( 'redirect_council' ); + } + } +} + 1; |