diff options
Diffstat (limited to 'bin/send-comments')
-rwxr-xr-x | bin/send-comments | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/bin/send-comments b/bin/send-comments index 1a12fa684..850a57758 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -1,7 +1,10 @@ #!/usr/bin/env perl -# send-reports: -# Send new problem reports to bodies +# send-comments: +# Send comments/updates on reports to bodies +# In Open311 parlance these are 'service request udpates' and are sent using +# mySociety's proposed extension to the Open311 Georeport v2 spec: +# https://github.com/mysociety/fixmystreet/wiki/Open311-FMS---Proposed-differences-to-Open311 # # Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org @@ -61,13 +64,20 @@ while ( my $body = $bodies->next ) { $use_extended = 1; } - my $o = Open311->new( + my %open311_conf = ( endpoint => $body->endpoint, jurisdiction => $body->jurisdiction, api_key => $body->api_key, use_extended_updates => $use_extended, ); + + if ( $body->send_extended_statuses ) { + $open311_conf{extended_statuses} = 1; + } + + my $o = Open311->new( %open311_conf ); + if ( $body->areas->{2482} ) { my $endpoints = $o->endpoints; $endpoints->{update} = 'update.xml'; @@ -78,6 +88,18 @@ while ( my $body = $bodies->next ) { while ( my $comment = $comments->next ) { my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new(); + # actually this should be OK for any devolved endpoint if original Open311->can_be_devolved, presumably + if ( $cobrand->moniker eq "fixmybarangay") { + my $sender = $cobrand->get_body_sender( $body, $comment->problem->category ); + my $config = $sender->{config}; + $o = Open311->new( + endpoint => $config->endpoint, + jurisdiction => $config->jurisdiction, + api_key => $config->api_key, + use_extended_updates => 1, # FMB uses extended updates + ); + } + if ( $comment->send_fail_count ) { next if bromley_retry_timeout( $comment ); } |