diff options
Diffstat (limited to 'bin/send-comments')
-rwxr-xr-x | bin/send-comments | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/send-comments b/bin/send-comments index b60c46e5d..24b436ac8 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -41,6 +41,7 @@ my $councils = FixMyStreet::App->model('DB::Open311Conf')->search( { } ); while ( my $council = $councils->next ) { + my $use_extended = 0; my $comments = FixMyStreet::App->model('DB::Comment')->search( { 'me.whensent' => undef, 'me.external_id' => undef, @@ -56,21 +57,46 @@ while ( my $council = $councils->next ) { } ); + if ( $council->area_id == 2482 ) { + $use_extended = 1; + } + my %open311_conf = ( endpoint => $council->endpoint, jurisdiction => $council->jurisdiction, api_key => $council->api_key, + use_extended_updates => $use_extended, ); + if ( $council->send_extended_statuses ) { $open311_conf{extended_statuses} = 1; } my $o = Open311->new( %open311_conf ); + if ( $council->area_id =~ /2482/ ) { + my $endpoints = $o->endpoints; + $endpoints->{update} = 'update.xml'; + $endpoints->{service_request_updates} = 'update.xml'; + $o->endpoints( $endpoints ); + } + 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_council_sender( $council->area_id, undef, $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 ); } |