aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-08-31 16:40:04 +0100
committerStruan Donald <struan@exo.org.uk>2012-08-31 16:40:04 +0100
commitbe97fe44d9954ce3c84d98030f2ebc6ae84a5a61 (patch)
treedc0de2a346624775331a4d3e22aa97a54d1019a8 /perllib/Open311
parent8e1336875a074adb7f906651233931e0ea4c22b7 (diff)
initial work to handle changed problem states
Diffstat (limited to 'perllib/Open311')
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index c30d05b22..2af128ec7 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -96,12 +96,22 @@ sub update_comments {
# do not change the status of the problem as it's
# tricky to determine the right thing to do.
if ( $comment->created_local > $p->lastupdate_local ) {
- if ( $p->is_open and lc($request->{status}) eq 'closed' ) {
+ my $incoming_status = lc( $request->{status} );
+ my $internal_status = $incoming_status;
+ $internal_status =~ s/_/ /g;
+ if ( $p->is_open and ( $incoming_status eq 'closed' or $incoming_status eq 'fixed' ) ) {
$p->state( 'fixed - council' );
$comment->problem_state( 'fixed - council' );
- } elsif ( ( $p->is_closed || $p->is_fixed ) and lc($request->{status}) eq 'open' ) {
+ } elsif ( ( $p->is_closed || $p->is_fixed ) and (
+ $incoming_status eq 'open' or FixMyStreet::DB::Result::Problem->open_states()->{ $internal_status }
+ ) ) {
$p->state( 'confirmed' );
$comment->problem_state( 'confirmed' );
+ } else {
+ if ( FixMyStreet::DB::Result::Problem->council_states()->{ $internal_status } ) {
+ $p->state( $internal_status );
+ $comment->problem_state( $internal_status );
+ }
}
}