diff options
author | Struan Donald <struan@exo.org.uk> | 2012-11-09 11:28:56 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-11-09 11:28:56 +0000 |
commit | 4a8ec58a44e09fa92d289d1a93eef1d8337b4385 (patch) | |
tree | e7a3e0a4bf2970f412105380af1baf620a93a5c9 /perllib/Open311 | |
parent | 3e0441e1dfc287bbdec0a5198f64ef3ff1f7f4ae (diff) |
be less restrictive about how open 311 status updates can change states
as logged in council users don't have the same restrictions
also, fix open311 status name of unable to fix
Diffstat (limited to 'perllib/Open311')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index c0b9dcac0..99e1d5758 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -98,15 +98,12 @@ sub update_comments { if ( $comment->created_local > $p->lastupdate_local ) { my $state = $self->map_state( $request->{status} ); - # do not change a fixed problem to a closed one - if ( $p->is_fixed && FixMyStreet::DB::Result::Problem->open_states()->{$state} ) { + # don't update state unless it's an allowed state and it's + # actually changing the state of the problem + if ( FixMyStreet::DB::Result::Problem->council_states()->{$state} && $p->state ne $state && + !( $p->is_fixed && FixMyStreet::DB::Result::Problem->fixed_states()->{$state} ) ) { $p->state($state); $comment->problem_state($state); - } elsif ( ( $p->is_open || $p->is_closed ) && $p->state ne $state ) { - if ( FixMyStreet::DB::Result::Problem->council_states() ->{$state} ) { - $p->state($state); - $comment->problem_state($state); - } } } @@ -144,6 +141,7 @@ sub map_state { my %state_map = ( fixed => 'fixed - council', 'not councils responsibility' => 'not responsible', + 'no further action' => 'unable to fix', open => 'confirmed', closed => 'fixed - council' ); |