aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
authorChris Mytton <chrism@mysociety.org>2020-05-15 17:42:06 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-10-12 13:38:03 +0100
commit19deaf332d2843e3b4337f3e2047bce47e4a7cd1 (patch)
tree0b8c09257b286eda03f188f61e76acb2aeec9439 /perllib/FixMyStreet/App/Controller
parentc778cff750282e814820b2f8ffee5e5c909e269a (diff)
[Oxfordshire] Add instruct defect functionality back in
In the past Oxfordshire had a way for inspectors to "instruct a defect", which generated a CSV which got emailed to Oxfordshire with a list of defects. They now want to bring this functionality back, but instead of emailing a CSV they want it to call an API. As a first step towards that goal, this change adds back some of the instruct defect functionality that was removed in 68e18ff.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 98c4aba17..1e5751588 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -467,7 +467,7 @@ sub inspect : Private {
}
}
- if ( $c->get_param('include_update') ) {
+ if ( $c->get_param('include_update') or $c->get_param('raise_defect') ) {
$update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } );
if (!$update_text) {
$valid = 0;
@@ -512,6 +512,14 @@ sub inspect : Private {
};
$c->user->create_alert($problem->id, $options);
}
+
+ # If the state has been changed to action scheduled and they've said
+ # they want to raise a defect, consider the report to be inspected.
+ if ($problem->state eq 'action scheduled' && $c->get_param('raise_defect') && !$problem->get_extra_metadata('inspected')) {
+ $update_params{extra} = { 'defect_raised' => 1 };
+ $problem->set_extra_metadata( inspected => 1 );
+ $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] );
+ }
}
$problem->non_public($c->get_param('non_public') ? 1 : 0);