diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-14 19:07:08 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-19 14:43:26 +0000 |
commit | ddf9dbdbf6486c781ca4a5822614b0b7cee2c062 (patch) | |
tree | 09c12affc3390138b03292d3f90810287b4941d0 /perllib/FixMyStreet/Cobrand/UK.pm | |
parent | da29e8a75eaa92e98807ad89d29d3d1f3c01bc14 (diff) |
Allow bodies to span multiple area IDs, and areas can be covered by more than one body.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/UK.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index 3ad58437e..ff613ffa8 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -34,7 +34,8 @@ sub disambiguate_location { sub _fallback_body_sender { my ( $self, $body, $category ) = @_; - my $area_info = mySociety::MaPit::call('area', $body->area_id); + my $first_area = $body->body_areas->first->area_id; + my $area_info = mySociety::MaPit::call('area', $first_area); return { method => 'London' } if $area_info->{type} eq 'LBO'; return { method => 'NI' } if $area_info->{type} eq 'LGD'; return { method => 'Email' }; @@ -43,11 +44,12 @@ sub _fallback_body_sender { sub process_extras { my $self = shift; my $ctx = shift; - my $area_id = shift; + my $body_id = shift; my $extra = shift; my $fields = shift || []; - if ( $area_id eq '2482' ) { + # XXX Hardcoded body ID matching mapit area ID + if ( $body_id eq '2482' ) { my @fields = ( 'fms_extra_title', @$fields ); for my $field ( @fields ) { my $value = $ctx->request->param( $field ); |