diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-09-05 12:00:57 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-09-05 12:00:57 +0100 |
commit | edd71a4f71052da7c3309a88de91d85d9f14c249 (patch) | |
tree | bf4f0aac4f5de64284d324968f6e102e6b0cf173 /perllib/FixMyStreet/App/Controller/Report/New.pm | |
parent | 2b8e2e59e63bd5a44070300c507546444296bafc (diff) | |
parent | 66341842f7d45bb8ee0f9ed8126d9d1c486c769f (diff) |
Merge branch 'issues/commercial/1543-asset-ordering'
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index c41b65e2a..103509863 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1025,7 +1025,16 @@ sub process_report : Private { my $body_string = do { if (my $single_body_only = $c->get_param('single_body_only')) { my $body = $c->model('DB::Body')->search({ name => $single_body_only })->first; - $body ? $body->id : '-1'; + if ($body) { + # Drop the contacts down to those in this body + # (potentially none for e.g. Highways England) + # so that set_report_extras doesn't error when + # there are 'missing' extra fields + @contacts = grep { $_->body->id == $body->id } @contacts; + $body->id; + } else { + '-1'; + } } else { my $contact_options = {}; $contact_options->{do_not_send} = [ $c->get_param_list('do_not_send', 1) ]; |