diff options
-rwxr-xr-x | bin/send-comments | 13 | ||||
-rw-r--r-- | perllib/Open311.pm | 7 |
2 files changed, 16 insertions, 4 deletions
diff --git a/bin/send-comments b/bin/send-comments index 7043df7b8..55c9da62b 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -48,9 +48,6 @@ while ( my $body = $bodies->next ) { # XXX Cobrand specific - see also list in Problem->updates_sent_to_body if ($site eq 'fixmystreet.com') { - # Oxfordshire (OCC) is special: - # we do *receive* service_request_updates (aka comments) for OCC, but we never *send* them, so skip this pass - next if $body->areas->{+COUNCIL_ID_OXFORDSHIRE}; # Lewisham does not yet accept updates next if $body->areas->{+COUNCIL_ID_LEWISHAM}; } @@ -83,6 +80,9 @@ while ( my $body = $bodies->next ) { use_extended_updates => $use_extended, ); + if ( $body->areas->{+COUNCIL_ID_OXFORDSHIRE} ) { + $open311_conf{use_customer_reference} = 1, + } if ( $body->send_extended_statuses ) { $open311_conf{extended_statuses} = 1; @@ -111,6 +111,13 @@ while ( my $body = $bodies->next ) { next; } + # Oxfordshire stores the external id of the problem as a customer reference + # in metadata + if ($body->areas->{+COUNCIL_ID_OXFORDSHIRE} && + !$comment->problem->get_extra_metadata('customer_reference') ) { + next; + } + # TODO actually this should be OK for any devolved endpoint if original Open311->can_be_devolved, presumably if ( 0 ) { # Check can_be_devolved and do this properly if set my $sender = $cobrand->get_body_sender( $body, $comment->problem->category ); diff --git a/perllib/Open311.pm b/perllib/Open311.pm index c48ff2c7a..7c12ee3a1 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -33,6 +33,7 @@ has use_extended_updates => ( is => 'ro', isa => Bool, default => 0 ); has extended_statuses => ( is => 'ro', isa => Bool, default => 0 ); has always_send_email => ( is => 'ro', isa => Bool, default => 0 ); has multi_photos => ( is => 'ro', isa => Bool, default => 0 ); +has use_customer_reference => ( is => 'ro', isa => Bool, default => 0 ); before [ qw/get_service_list get_service_meta_info get_service_requests get_service_request_updates @@ -368,9 +369,13 @@ sub _populate_service_request_update_params { } } + my $service_request_id = $comment->problem->external_id; + if ( $self->use_customer_reference ) { + $service_request_id = $comment->problem->get_extra_metadata('customer_reference'); + } my $params = { updated_datetime => DateTime::Format::W3CDTF->format_datetime($comment->confirmed->set_nanosecond(0)), - service_request_id => $comment->problem->external_id, + service_request_id => $service_request_id, status => $status, description => $comment->text, last_name => $lastname, |