aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-09-04 17:52:07 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-09-04 17:52:36 +0100
commit66341842f7d45bb8ee0f9ed8126d9d1c486c769f (patch)
treebe0be3cf0329e45678a71ab0258b7d676f9ab224 /perllib/FixMyStreet/App/Controller/Report/New.pm
parent1d78ea3872d48c9184e9b1df183c5d5a0c1d605f (diff)
Make sure extras hidden when only_send is active.
The extras may be a confusing stopper message that only applies to the 'main' body, or it may be extra questions that are now not required. Either way, we should hide this information, and we need to make sure the server no longer checks if required extra questions have been answered.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm11
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) ];