From 1b46273ffd41876b95a96cdaa41ef5f99b04f643 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 8 Aug 2018 16:12:58 +0100 Subject: [Open311] turn on comment sending for OCC but only send if the problem as a customer reference and use that as the external id reference --- bin/send-comments | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'bin/send-comments') 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 ); -- cgit v1.2.3