aboutsummaryrefslogtreecommitdiffstats
path: root/bin/open311-update-reports
blob: 6a1c894d732de45123d54c849981bf3951829122 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
#
# This script utilises the standard Open311 way of getting updates on reports
# (by fetching all reports for a body and looking for updates). If possible,
# please use the extension explained at
# https://github.com/mysociety/FixMyStreet/wiki/Open311-FMS---Proposed-differences-to-Open311
# and the fetch-comments/send-comments scripts.

use strict;
use warnings;

BEGIN {
    use File::Basename qw(dirname);
    use File::Spec;
    my $d = dirname(File::Spec->rel2abs($0));
    require "$d/../setenv.pl";
}

use Open311::GetUpdates;
use FixMyStreet::App;

# FIXME - make this configurable and/or better
my $system_user = FixMyStreet::App->model('DB::User')->find_or_create(
    {
        email => FixMyStreet::App->config->{'CONTACT_EMAIL'},
        name => 'System User',
    }
);

my $body_list = FixMyStreet::App->model('DB::Body');

my $update = Open311::GetUpdates->new(
    body_list => $body_list,
    system_user  => $system_user
)->get_updates;