diff options
author | Dave Arter <davea@mysociety.org> | 2016-09-06 15:37:42 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-09-09 14:14:37 +0100 |
commit | 54a2b63fac54d01914fd2bb456da483e6982ee21 (patch) | |
tree | 574fe83a0dcf2cba219d32f440f44cde1dbc3132 /perllib/FixMyStreet/App/Controller/Report.pm | |
parent | f8f870be0f9f648b48896cb6411446b7f9e049ce (diff) |
Refactor problem response priority into its own model
This moves the response priority values from a cobrand-specific method to a full
DB model, and includes management screens in the admin for administering them.
For mysociety/fixmystreetforcouncils#66
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 7f1132117..6a7a14b5c 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -307,21 +307,10 @@ sub inspect : Private { $c->stash->{categories} = $c->forward('/admin/categories_for_point'); - # The available priorities for this problem are dependent on the cobrand it - # was reported to, not necessarily the active cobrand (e.g. inspecting a - # report on fms.com that was sent to Oxfordshire), so make sure the correct - # priorities are available for selection. - if ( $c->cobrand->can('get_body_handler_for_problem') ) { - my $handler = $c->cobrand->get_body_handler_for_problem($c->stash->{problem}); - if ( $handler->can('problem_response_priorities') ) { - $c->stash->{priorities} = $handler->problem_response_priorities; - } - } - if ( $c->get_param('save') || $c->get_param('save_inspected') ) { $c->forward('/auth/check_csrf_token'); - foreach (qw/priority detailed_location detailed_information traffic_information/) { + foreach (qw/detailed_location detailed_information traffic_information/) { $problem->set_extra_metadata( $_ => $c->get_param($_) ); } @@ -342,6 +331,8 @@ sub inspect : Private { $c->forward( '/admin/log_edit', [ $id, 'problem', 'state_change' ] ); } + $problem->response_priority( $problem->response_priorities->find({ id => $c->get_param('priority') }) ); + my $valid = 1; if ( !$c->forward( '/admin/report_edit_location', [ $problem ] ) ) { # New lat/lon isn't valid, show an error |