aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Script/Reports.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
committerMarius Halden <marius.h@lden.org>2017-05-28 21:31:42 +0200
commit987124b09a32248414faf4d0d6615d43b29ac6f6 (patch)
treea549db8af723c981d3b346e855f25d6fd5ff8aa7 /perllib/FixMyStreet/Script/Reports.pm
parentdbf56159e44c1560a413022451bf1a1c4cb22a52 (diff)
parenta085b63ce09f87e83b75cda9b9cd08aadfe75d61 (diff)
Merge tag 'v2.0.4' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/Script/Reports.pm')
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm10
1 files changed, 4 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index 7d614bc30..6057807de 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -28,7 +28,7 @@ sub send(;$) {
my $base_url = FixMyStreet->config('BASE_URL');
my $site = $site_override || CronFns::site($base_url);
- my $states = [ 'confirmed', 'fixed' ];
+ my $states = [ FixMyStreet::DB::Result::Problem::open_states() ];
$states = [ 'unconfirmed', 'confirmed', 'in progress', 'planned', 'closed', 'investigating' ] if $site eq 'zurich';
my $unsent = $rs->search( {
state => $states,
@@ -112,9 +112,7 @@ sub send(;$) {
$h{user_details} .= sprintf(_('Email: %s'), $row->user->email) . "\n\n";
}
- if ($cobrand->can('process_additional_metadata_for_email')) {
- $cobrand->process_additional_metadata_for_email($row, \%h);
- }
+ $cobrand->call_hook(process_additional_metadata_for_email => $row, \%h);
my $bodies = FixMyStreet::DB->resultset('Body')->search(
{ id => $row->bodies_str_ids },
@@ -211,7 +209,7 @@ sub send(;$) {
. " ]\n\n";
}
- if (FixMyStreet->config('STAGING_SITE') && !FixMyStreet->config('SEND_REPORTS_ON_STAGING')) {
+ if (FixMyStreet->staging_flag('send_reports', 0)) {
# on a staging server send emails to ourselves rather than the bodies
%reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::Email/ } keys %reporters;
unless (%reporters) {
@@ -276,7 +274,7 @@ sub send(;$) {
}
my $sending_errors = '';
my $unsent = $rs->search( {
- state => [ 'confirmed', 'fixed' ],
+ state => [ FixMyStreet::DB::Result::Problem::open_states() ],
whensent => undef,
bodies_str => { '!=', undef },
send_fail_count => { '>', 0 }