aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-comments2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm10
-rw-r--r--perllib/FixMyStreet/Cobrand/LichfieldDC.pm5
3 files changed, 9 insertions, 8 deletions
diff --git a/bin/send-comments b/bin/send-comments
index 7520af17d..ed13f10ba 100755
--- a/bin/send-comments
+++ b/bin/send-comments
@@ -49,7 +49,7 @@ while ( my $body = $bodies->next ) {
'me.confirmed' => { '!=' => undef },
'problem.whensent' => { '!=' => undef },
'problem.external_id' => { '!=' => undef },
- 'problem.bodies_str' => { -like => '%' . $body->area_id .'%' },
+ 'problem.bodies_str' => { -like => '%' . $body->id . '%' },
'problem.send_method_used' => 'Open311',
},
{
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 ) {
diff --git a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
index 51f368957..f9d5e3632 100644
--- a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
+++ b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
@@ -27,10 +27,11 @@ sub disambiguate_location {
}
# If we ever link to a county problem report, needs to be to main FixMyStreet
-# XXX Assumes body ID equals mapit area ID
sub base_url_for_report {
my ( $self, $report ) = @_;
- if ( $report->bodies->{2434} ) {
+ my $bodies = $report->bodies;
+ my %areas = map { $_->area_id => 1 } values %$bodies;
+ if ( $areas{2434} ) {
return $self->base_url;
} else {
return FixMyStreet->config('BASE_URL');