diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-06 14:04:23 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-07 09:14:38 +0100 |
commit | c93ebfa26b864c26b9219b59f6676371e434ea0a (patch) | |
tree | 10f06ab20e600571ad3ad0556aeeeb1980799986 /perllib | |
parent | 5fc8fc8eadc4abfb207df423169d179c6d9c922a (diff) |
[Oxfordshire] Separate defect creation from state.
Revert the behaviour from 36baff2d, so that everyone can use the 'action
scheduled' state, and instead if someone with report_instruct permission
has the state set to 'action scheduled', add an extra mandatory question
asking whether they want to raise a defect or not.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index ef10dc32e..81abba3ac 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -367,15 +367,9 @@ sub inspect : Private { if ( $problem->state ne $old_state ) { $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'state_change' ] ); - # If the state has been changed by an inspector, consider the - # report to be inspected. - unless ($problem->get_extra_metadata('inspected')) { - $problem->set_extra_metadata( inspected => 1 ); - $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); - my $state = $problem->state; - $reputation_change = 1 if $c->cobrand->reputation_increment_states->{$state}; - $reputation_change = -1 if $c->cobrand->reputation_decrement_states->{$state}; - } + my $state = $problem->state; + $reputation_change = 1 if $c->cobrand->reputation_increment_states->{$state}; + $reputation_change = -1 if $c->cobrand->reputation_decrement_states->{$state}; # If an inspector has changed the state, subscribe them to # updates @@ -386,6 +380,13 @@ sub inspect : Private { }; $problem->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')) { + $problem->set_extra_metadata( inspected => 1 ); + $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); + } } if ( !$c->forward( '/admin/report_edit_location', [ $problem ] ) ) { |