diff options
author | Struan Donald <struan@exo.org.uk> | 2012-05-11 13:17:27 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-05-11 13:17:27 +0100 |
commit | 5accaad402d24f37851d8b85084fda2859b1ae16 (patch) | |
tree | ca923c4170bea77fe40ba8ae13c34a9b4c99d6d1 /perllib/Open311/GetServiceRequestUpdates.pm | |
parent | fda83d5c4c9962c17fd0629e8ee17b50e3dbbac4 (diff) |
add ability to suppress alerts to report creator on
comments updated from open311
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index b656da879..b5577ff6c 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -9,6 +9,7 @@ has council_list => ( is => 'ro' ); has system_user => ( is => 'rw' ); has start_date => ( is => 'ro', default => undef ); has end_date => ( is => 'ro', default => undef ); +has suppress_alerts => ( is => 'rw', default => 0 ); sub fetch { my $self = shift; @@ -30,6 +31,7 @@ sub fetch { jurisdiction => $council->jurisdiction, ); + $self->suppress_alerts( $council->suppress_alerts ); $self->system_user( $council->comment_user ); $self->update_comments( $o, { areaid => $council->area_id }, ); } @@ -110,6 +112,20 @@ sub update_comments { } $comment->insert(); + + if ( $self->suppress_alerts ) { + my $alert = FixMyStreet::App->model('DB::Alert')->find( { + alert_type => 'new_updates', + parameter => $p->id, + confirmed => 1, + user_id => $p->user->id, + } ); + + my $alerts_sent = FixMyStreet::App->model('DB::AlertSent')->find_or_create( { + alert_id => $alert->id, + parameter => $comment->id, + } ); + } } } } |