aboutsummaryrefslogtreecommitdiffstats
path: root/bin/send-comments
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-01 15:28:08 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-04 06:53:02 +0000
commit488a8f21a0c1bc2b9501c9d94d69db56cccd80ae (patch)
tree68becf501e9492466a80015e8ace9a7fb1557cfa /bin/send-comments
parent3e0d12e8584d132b573f536ab5cd01e24241827b (diff)
parent28aa1dd7fb1c9bc93aa204afae67cf68fe36ee6b (diff)
Merge remote branch 'origin/zurich'
Conflicts: bin/open311-populate-service-list bin/send-comments bin/update-all-reports conf/crontab.ugly db/schema.sql perllib/FixMyStreet/App/Controller/Admin.pm perllib/FixMyStreet/App/Controller/Report/New.pm perllib/FixMyStreet/App/Controller/Reports.pm perllib/FixMyStreet/Cobrand/Default.pm perllib/FixMyStreet/Cobrand/LichfieldDC.pm perllib/FixMyStreet/DB/Result/Open311conf.pm perllib/FixMyStreet/DB/Result/Problem.pm perllib/FixMyStreet/DB/ResultSet/Problem.pm perllib/FixMyStreet/SendReport.pm perllib/FixMyStreet/SendReport/Email.pm perllib/FixMyStreet/SendReport/Open311.pm perllib/Open311/GetServiceRequestUpdates.pm perllib/Open311/PopulateServiceList.pm t/app/controller/report_new.t t/app/controller/rss.t templates/web/bromley/report/display.html templates/web/default/admin/council_contacts.html templates/web/default/common_header_tags.html templates/web/default/dashboard/index.html templates/web/default/front/stats.html templates/web/default/report/_main.html templates/web/default/report/update-form.html templates/web/emptyhomes/index.html templates/web/emptyhomes/report/display.html templates/web/emptyhomes/report/new/councils_text_all.html templates/web/emptyhomes/reports/body.html templates/web/emptyhomes/reports/index.html templates/web/fixmystreet/report/new/fill_in_details_form.html templates/web/fixmystreet/report/update-form.html web/cobrands/fixmystreet/fixmystreet.js web/js/fixmystreet.js
Diffstat (limited to 'bin/send-comments')
-rwxr-xr-xbin/send-comments24
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/send-comments b/bin/send-comments
index 232521447..850a57758 100755
--- a/bin/send-comments
+++ b/bin/send-comments
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# send-comments:
-# Send comments/updates on reports to councils
+# 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
@@ -38,12 +38,12 @@ my ($verbose, $nomail) = CronFns::options();
my $base_url = mySociety::Config::get('BASE_URL');
my $site = CronFns::site($base_url);
-my $councils = FixMyStreet::App->model('DB::Open311Conf')->search( {
+my $bodies = FixMyStreet::App->model('DB::Body')->search( {
send_method => SEND_METHOD_OPEN311,
send_comments => 1,
} );
-while ( my $council = $councils->next ) {
+while ( my $body = $bodies->next ) {
my $use_extended = 0;
my $comments = FixMyStreet::App->model('DB::Comment')->search( {
'me.whensent' => undef,
@@ -52,7 +52,7 @@ while ( my $council = $councils->next ) {
'me.confirmed' => { '!=' => undef },
'problem.whensent' => { '!=' => undef },
'problem.external_id' => { '!=' => undef },
- 'problem.council' => { -like => '%' . $council->area_id .'%' },
+ 'problem.bodies_str' => { -like => '%' . $body->id . '%' },
'problem.send_method_used' => 'Open311',
},
{
@@ -60,25 +60,25 @@ while ( my $council = $councils->next ) {
}
);
- if ( $council->area_id == 2482 ) {
+ if ( $body->areas->{2482} ) {
$use_extended = 1;
}
my %open311_conf = (
- endpoint => $council->endpoint,
- jurisdiction => $council->jurisdiction,
- api_key => $council->api_key,
+ endpoint => $body->endpoint,
+ jurisdiction => $body->jurisdiction,
+ api_key => $body->api_key,
use_extended_updates => $use_extended,
);
- if ( $council->send_extended_statuses ) {
+ if ( $body->send_extended_statuses ) {
$open311_conf{extended_statuses} = 1;
}
my $o = Open311->new( %open311_conf );
- if ( $council->area_id =~ /2482/ ) {
+ if ( $body->areas->{2482} ) {
my $endpoints = $o->endpoints;
$endpoints->{update} = 'update.xml';
$endpoints->{service_request_updates} = 'update.xml';
@@ -90,7 +90,7 @@ while ( my $council = $councils->next ) {
# 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 $sender = $cobrand->get_body_sender( $body, $comment->problem->category );
my $config = $sender->{config};
$o = Open311->new(
endpoint => $config->endpoint,
@@ -104,7 +104,7 @@ while ( my $council = $councils->next ) {
next if bromley_retry_timeout( $comment );
}
- if ( $council->area_id == 2482 ) {
+ if ( $body->areas->{2482} ) {
my $extra = $comment->extra;
if ( !$extra ) {
$extra = {};