aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-comments8
-rw-r--r--db/schema.sql3
-rw-r--r--db/schema_0026-add_send_extended_comments_to_open311conf.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm4
-rw-r--r--perllib/FixMyStreet/DB/Result/Open311conf.pm6
-rw-r--r--templates/web/default/admin/council_contacts.html5
6 files changed, 27 insertions, 5 deletions
diff --git a/bin/send-comments b/bin/send-comments
index b054ebd8f..b60c46e5d 100755
--- a/bin/send-comments
+++ b/bin/send-comments
@@ -56,12 +56,18 @@ while ( my $council = $councils->next ) {
}
);
- my $o = Open311->new(
+ my %open311_conf = (
endpoint => $council->endpoint,
jurisdiction => $council->jurisdiction,
api_key => $council->api_key,
);
+ if ( $council->send_extended_statuses ) {
+ $open311_conf{extended_statuses} = 1;
+ }
+
+ my $o = Open311->new( %open311_conf );
+
while ( my $comment = $comments->next ) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new();
diff --git a/db/schema.sql b/db/schema.sql
index d714a463b..ef1bee624 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -446,5 +446,6 @@ create table open311conf (
send_method text,
send_comments boolean not null default 'f',
comment_user_id int references users(id),
- suppress_alerts boolean not null default 'f'
+ suppress_alerts boolean not null default 'f',
+ send_extended_statuses boolean not null default 'f'
);
diff --git a/db/schema_0026-add_send_extended_comments_to_open311conf.sql b/db/schema_0026-add_send_extended_comments_to_open311conf.sql
new file mode 100644
index 000000000..ee7b44b75
--- /dev/null
+++ b/db/schema_0026-add_send_extended_comments_to_open311conf.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER table open311conf
+ ADD column send_extended_statuses BOOL NOT NULL DEFAULT 'f';
+
+commit;
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 1efa2827b..54d744ccd 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -338,7 +338,7 @@ sub update_contacts : Private {
} elsif ( $posted eq 'open311' ) {
$c->forward('check_token');
- my %params = map { $_ => $c->req->param($_) || '' } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts comment_user_id/;
+ my %params = map { $_ => $c->req->param($_) || '' } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts extended_statuses comment_user_id/;
if ( $params{open311_id} ) {
my $conf = $c->model('DB::Open311Conf')->find( { id => $params{open311_id} } );
@@ -350,6 +350,7 @@ sub update_contacts : Private {
$conf->send_comments( $params{send_comments} || 0);
$conf->suppress_alerts( $params{suppress_alerts} || 0);
$conf->comment_user_id( $params{comment_user_id} || undef );
+ $conf->send_extended_statuses( $params{extended_statuses} || 0 );
$conf->update();
@@ -364,6 +365,7 @@ sub update_contacts : Private {
$conf->send_comments( $params{send_comments} || 0);
$conf->suppress_alerts( $params{suppress_alerts} || 0);
$conf->comment_user_id( $params{comment_user_id} || undef );
+ $conf->send_extended_statuses( $params{extended_statuses} || 0 );
$conf->insert();
diff --git a/perllib/FixMyStreet/DB/Result/Open311conf.pm b/perllib/FixMyStreet/DB/Result/Open311conf.pm
index c95b0c8f2..6748db825 100644
--- a/perllib/FixMyStreet/DB/Result/Open311conf.pm
+++ b/perllib/FixMyStreet/DB/Result/Open311conf.pm
@@ -34,6 +34,8 @@ __PACKAGE__->add_columns(
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"suppress_alerts",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "send_extended_statuses",
+ { data_type => "boolean", default_value => \"false", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("open311conf_area_id_key", ["area_id"]);
@@ -50,8 +52,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-05-11 13:30:31
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ByJbRe/Y/9Z1WHdG8kaIHg
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-10-03 14:49:22
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OO3kNIohRp+84PGI2154fg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/templates/web/default/admin/council_contacts.html b/templates/web/default/admin/council_contacts.html
index e35c8cda2..ac6698510 100644
--- a/templates/web/default/admin/council_contacts.html
+++ b/templates/web/default/admin/council_contacts.html
@@ -146,6 +146,11 @@
</p>
<p>
+ <label for="extended_statuses">Send extended open311 statuses with service request updates</label>:
+ <input type="checkbox" name="extended_statuses"[% ' checked' IF conf.send_extended_statuses %]>
+ </p>
+
+ <p>
<input type="hidden" name="open311_id" value="[% conf.id %]">
<input type="hidden" name="area_id" value="[% area_id %]">
<input type="hidden" name="posted" value="open311">