aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-03-02 16:27:21 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-03-02 16:27:21 +0000
commit9154199ddf8ddb373ca34758f96d009401e4dc81 (patch)
tree517912792aa075e4b4b33b2e8b58375a794081cb
parentce1e33244a53db2000689a52e4b1eecd68105290 (diff)
[Zurich] Do not reopen closed reports by mistake.
The code for moving a report to the intermediary state was running even if the report was in a closed state and had not been changed.
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm7
-rw-r--r--t/cobrand/zurich.t3
2 files changed, 6 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index f0308d6d7..06244ccd4 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -639,7 +639,7 @@ sub admin_report_edit {
my $closure_states = $self->zurich_closed_states;
delete $closure_states->{'fixed - council'}; # may not be needed?
- my $old_closure_state = $problem->get_extra_metadata('closure_status');
+ my $old_closure_state = $problem->get_extra_metadata('closure_status') || '';
# update the public update from DM
if (my $update = $c->get_param('status_update')) {
@@ -661,9 +661,8 @@ sub admin_report_edit {
$internal_note_text = "Weitergeleitet von $old_cat an $new_cat";
$self->update_admin_log($c, $problem, "Changed category from $old_cat to $new_cat");
$redirect = 1 if $cat->body_id ne $body->id;
- } elsif ( $closure_states->{$state} and
- ( $oldstate ne 'planned' )
- || (($old_closure_state ||'') ne $state))
+ } elsif ( $oldstate ne $state and $closure_states->{$state} and
+ $oldstate ne 'planned' || $old_closure_state ne $state)
{
# for these states
# - closed (Extern)
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index 385f7f077..5c1ff9a0e 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -289,6 +289,9 @@ subtest "report_edit" => sub {
is ( $report->state, 'hidden', 'Closing as hidden sets state to hidden');
is ( $report->get_extra_metadata('closure_status'), undef, 'Closing as hidden unsets closure_status');
+ $mech->submit_form_ok( { with_fields => { new_internal_note => 'Initial internal note.' } } );
+ $report->discard_changes;
+ is ( $report->state, 'hidden', 'Another internal note does not reopen');
reset_report_state($report);
is ( $report->get_extra_metadata('moderated_overdue'), undef, 'Sanity check' );