aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-08-09 16:37:41 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-08-09 16:37:41 +0100
commita18c143e8aacd978bbe9c055fa2b3a225a5d4f09 (patch)
tree22f391e8cae0374239c5d5f447f9e6676b6d501c /perllib/FixMyStreet/App/Controller/Report/New.pm
parent66e9a60124c5df10b33efc21b0bf2d64b91e4c7b (diff)
parentc708d6f2d30c5da1b603d227ba013c63c8673457 (diff)
Merge branch 'report-extras-already-in-report'
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 2246f6aea..120467905 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -104,6 +104,7 @@ sub report_new : Path : Args(0) {
$c->forward('setup_report_extra_fields');
$c->forward('generate_map');
$c->forward('check_for_category');
+ $c->forward('setup_report_extras');
# deal with the user and report and check both are happy
@@ -1073,6 +1074,14 @@ sub contacts_to_bodies : Private {
[ map { $_->body } @contacts ];
}
+sub setup_report_extras : Private {
+ my ($self, $c) = @_;
+
+ # report_meta is used by the templates to fill in the extra field values
+ my $extra = $c->stash->{report}->get_extra_fields;
+ $c->stash->{report_meta} = { map { 'x' . $_->{name} => $_ } @$extra };
+}
+
sub set_report_extras : Private {
my ($self, $c, $contacts, $param_prefix) = @_;
@@ -1458,7 +1467,7 @@ sub generate_map : Private {
sub check_for_category : Private {
my ( $self, $c ) = @_;
- $c->stash->{category} = $c->get_param('category');
+ $c->stash->{category} = $c->get_param('category') || $c->stash->{report}->category;
return 1;
}