diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-06-22 12:57:51 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-06-22 14:27:49 +0100 |
commit | b9ff1828d109befbe279698d7403889e9987c704 (patch) | |
tree | 140005cf2f927f473c1df7c7efac1d27241695c6 /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | d268f042ce441485b3512308055f37bd08c63588 (diff) |
Defect type changes must be after category change.
As with priorities, they depend upon the category and so must be
looked up after that has been updated.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 669d3c41f..a1f357644 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -375,12 +375,6 @@ sub inspect : Private { } } - if ( $c->get_param('defect_type') ) { - $problem->defect_type($problem->defect_types->find($c->get_param('defect_type'))); - } else { - $problem->defect_type(undef); - } - if ( $c->get_param('include_update') ) { $update_text = Utils::cleanup_text( $c->get_param('public_update'), { allow_multiline => 1 } ); if (!$update_text) { @@ -461,7 +455,8 @@ sub inspect : Private { $c->forward('/report/new/set_report_extras', [ \@contacts, $param_prefix ]); } - # Updating priority must come after category, in case category has changed (and so might have priorities) + # Updating priority/defect type must come after category, in case + # category has changed (and so might have priorities/defect types) if ($permissions->{report_inspect} || $permissions->{report_edit_priority}) { if ($c->get_param('priority')) { $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) ); @@ -470,6 +465,14 @@ sub inspect : Private { } } + if ($permissions->{report_inspect}) { + if ( $c->get_param('defect_type') ) { + $problem->defect_type($problem->defect_types->find($c->get_param('defect_type'))); + } else { + $problem->defect_type(undef); + } + } + if ($valid) { if ( $reputation_change != 0 ) { $problem->user->update_reputation($reputation_change); |