aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm10
-rw-r--r--perllib/FixMyStreet/Cobrand/Hounslow.pm13
-rw-r--r--perllib/FixMyStreet/Cobrand/Northamptonshire.pm11
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm2
5 files changed, 27 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 554fbc3b7..9a18d0e32 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -771,6 +771,8 @@ sub setup_categories_and_bodies : Private {
my %category_groups = ();
for my $category (@category_options) {
my $group = $category->{group} // $category->get_extra_metadata('group') // [''];
+ # multiple groups from open311 can contain " which upsets the html so strip them
+ $group =~ s/^"|"$//g;
# this could be an array ref or a string
my @groups = ref $group eq 'ARRAY' ? @$group : ($group);
push( @{$category_groups{$_}}, $category ) for @groups;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index 015da5e0b..e5327b084 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -200,4 +200,14 @@ sub updates_disallowed {
return $self->next::method(@_);
}
+sub suppress_reporter_alerts {
+ my $self = shift;
+ my $c = $self->{c};
+ my $problem = $c->stash->{report};
+ if ($problem->to_body_named('Westminster')) {
+ return 1;
+ }
+ return 0;
+}
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/Hounslow.pm b/perllib/FixMyStreet/Cobrand/Hounslow.pm
index 58da5160c..2146f2b67 100644
--- a/perllib/FixMyStreet/Cobrand/Hounslow.pm
+++ b/perllib/FixMyStreet/Cobrand/Hounslow.pm
@@ -73,14 +73,8 @@ sub link_to_council_cobrand { "Hounslow Highways" }
# Instead, force the borough council name to be used.
sub all_reports_single_body { { name => "Hounslow Borough Council" } }
-sub open311_pre_send {
- my ($self, $row, $open311, $h) = @_;
-
- return unless $row->isa("FixMyStreet::DB::Result::Problem");
-
- # Reload the problem from the DB, as we want to save our changes to it
- # without affecting the existing instance.
- $row = $row->result_source->resultset->find( { id => $row->id } );
+sub open311_post_send {
+ my ($self, $row, $h) = @_;
# Stop the email being sent for each Open311 failure; only the once.
return if $row->get_extra_metadata('hounslow_email_sent');
@@ -88,8 +82,7 @@ sub open311_pre_send {
my $e = join( '@', 'enquiries', $self->council_url . 'highways.org' );
my $sender = FixMyStreet::SendReport::Email->new( to => [ [ $e, 'Hounslow Highways' ] ] );
if (!$sender->send($row, $h)) {
- $row->set_extra_metadata('hounslow_email_sent', 1);
- $row->update;
+ $row->set_extra_metadata('hounslow_email_sent', 1);
}
}
diff --git a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
index f16700820..7baeaba96 100644
--- a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
@@ -76,6 +76,17 @@ sub open311_config {
$params->{multi_photos} = 1;
}
+sub open311_get_update_munging {
+ my ($self, $comment) = @_;
+
+ # If we've received an update via Open311, let us always take its state change
+ my $state = $comment->problem_state;
+ my $p = $comment->problem;
+ if ($state && $p->state ne $state && $p->is_visible) {
+ $p->state($state);
+ }
+}
+
sub should_skip_sending_update {
my ($self, $comment) = @_;
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index 7445699a2..fcb6f7298 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -74,7 +74,7 @@ sub send {
my $open311 = Open311->new( %open311_params );
- $cobrand->call_hook(open311_pre_send => $row, $open311, $h);
+ $cobrand->call_hook(open311_pre_send => $row, $open311);
my $resp = $open311->send_service_request( $row, $h, $contact->email );
if (FixMyStreet->test_mode) {