aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Script/Reports.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Script/Reports.pm')
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index dd8f4e370..5cadd4fa2 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -211,12 +211,13 @@ sub send(;$) {
# Multiply results together, so one success counts as a success.
my $result = -1;
+ my @methods;
for my $sender ( keys %reporters ) {
debug_print("sending using " . $sender, $row->id) if $debug_mode;
$sender = $reporters{$sender};
my $res = $sender->send( $row, \%h );
$result *= $res;
- $row->add_send_method($sender) if !$res;
+ push @methods, $sender if !$res;
if ( $sender->unconfirmed_counts) {
foreach my $e (keys %{ $sender->unconfirmed_counts } ) {
foreach my $c (keys %{ $sender->unconfirmed_counts->{$e} }) {
@@ -229,6 +230,12 @@ sub send(;$) {
if FixMyStreet->test_mode && $sender->can('open311_test_req_used');
}
+ # Add the send methods now because e.g. Open311
+ # send() calls $row->discard_changes
+ foreach (@methods) {
+ $row->add_send_method($_);
+ }
+
unless ($result) {
$row->update( {
whensent => \'current_timestamp',