diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-12-14 14:31:41 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-12-15 00:11:06 +0000 |
commit | ac71de34b015176b44d35c83cf5e4a838ed75723 (patch) | |
tree | b5b1fcc1fc6932ddc8551818c3d00bef79f8e855 /perllib/FixMyStreet/App/Controller | |
parent | 2d16a64009e3bd512bfe69dbf58f6091ab826049 (diff) |
Remove some linkages between area and body IDs.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 0cb56d67a..09e46ccef 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -582,6 +582,7 @@ sub setup_categories_and_bodies : Private { my @bodies = $c->model('DB::Body')->search( { area_id => [ keys %$all_areas ] } )->all; my %bodies = map { $_->id => $_ } @bodies; + my $first_body = ( values %bodies )[0]; my @contacts # = $c # @@ -620,8 +621,7 @@ sub setup_categories_and_bodies : Private { } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') { - # Assumes body ID and area ID match here - $bodies_to_list{ $first_area->{id} } = 1; + $bodies_to_list{ $first_body->id } = 1; my @local_categories; if ($first_area->{id} == COUNCIL_ID_BARNET) { @local_categories = sort keys %{ Utils::barnet_categories() } @@ -812,6 +812,7 @@ sub process_report : Private { $areas = $c->stash->{all_areas}; my $bodies = $c->stash->{bodies}; my $first_area = ( values %$areas )[0]; + my $first_body = ( values %$bodies )[0]; if ( $c->cobrand->moniker eq 'emptyhomes' ) { @@ -820,18 +821,17 @@ sub process_report : Private { } elsif ( $first_area->{id} == COUNCIL_ID_BARNET ) { - # As in setup, assumes body ID == area ID for London unless ( exists Utils::barnet_categories()->{ $report->category } ) { $c->stash->{field_errors}->{category} = _('Please choose a category'); } - $report->bodies_str( $first_area->{id} ); + $report->bodies_str( $first_body->id ); } elsif ( $first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') { unless ( Utils::london_categories()->{ $report->category } ) { $c->stash->{field_errors}->{category} = _('Please choose a category'); } - $report->bodies_str( $first_area->{id} ); + $report->bodies_str( $first_body->id ); } elsif ( $report->category ) { |