aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-10-04 11:46:29 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-10-04 11:58:06 +0100
commit505aa9bcba1fe2f419e95cfa5122fab83b6f6ae0 (patch)
tree9a2118ee5dc352d7a037626a101f1697c40d5210 /perllib/FixMyStreet/App/Controller/Report.pm
parentead4a7ebbd33ac3e6e2c6bf3cb0302189eae99d1 (diff)
parentd8fdbf5d353238d9e4c334f06de251987f7e60cf (diff)
Merge branch 'issues/forcouncils/36-mobile-inspector-improvements'
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index d56521fde..db3b16dcd 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -311,8 +311,9 @@ sub inspect : Private {
my $problem = $c->stash->{problem};
$c->stash->{categories} = $c->forward('/admin/categories_for_point');
+ $c->stash->{report_meta} = { map { $_->{name} => $_ } @{ $c->stash->{problem}->get_extra_fields() } };
- if ( $c->get_param('save') || $c->get_param('save_inspected') ) {
+ if ( $c->get_param('save') ) {
$c->forward('/auth/check_csrf_token');
my $valid = 1;
@@ -320,7 +321,7 @@ sub inspect : Private {
my $reputation_change = 0;
if ($permissions->{report_inspect}) {
- foreach (qw/detailed_location detailed_information traffic_information/) {
+ foreach (qw/detailed_information traffic_information/) {
$problem->set_extra_metadata( $_ => $c->get_param($_) );
}
@@ -363,6 +364,14 @@ sub inspect : Private {
if ($permissions->{report_inspect} || $permissions->{report_edit_category}) {
$c->forward( '/admin/report_edit_category', [ $problem ] );
+
+ # The new category might require extra metadata (e.g. pothole size), so
+ # we need to update the problem with the new values.
+ my $param_prefix = lc $problem->category;
+ $param_prefix =~ s/[^a-z]//g;
+ $param_prefix = "category_" . $param_prefix . "_";
+ my @contacts = grep { $_->category eq $problem->category } @{$c->stash->{contacts}};
+ $c->forward('/report/new/set_report_extras', [ \@contacts, $param_prefix ]);
}
if ($valid) {