diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/send-reports | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/send-reports b/bin/send-reports index 08be1677f..8e2f2bd9b 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: send-reports,v 1.22 2007-03-21 14:39:47 matthew Exp $ +# $Id: send-reports,v 1.23 2007-03-21 16:23:58 matthew Exp $ use strict; require 5.8.0; @@ -51,19 +51,20 @@ foreach my $row (@$unsent) { # XXX Needs locks! my @councils = split ',', $row->{council}; my $areas_info = mySociety::MaPit::get_voting_areas_info(\@councils); - my (@to, %recips); + my (@to, @dear, %recips); my $all_confirmed = 1; foreach my $council (@councils) { my $name = $areas_info->{$council}->{name}; my ($council_email,$confirmed) = dbh()->selectrow_array( "SELECT email,confirmed FROM contacts WHERE deleted='f' - and area_id=? AND category='Other'", {}, $council); - next unless $council_email; # Ignore missing councils + and area_id=? AND category=?", {}, $council, $row->{category}); + next unless $council_email; # Ignore missing councils, or non-responsible councils unless ($confirmed) { $all_confirmed = 0; $notgot{$council_email}++; } push @to, [ $council_email, $name ]; + push @dear, $name; $recips{$council_email} = 1; } my @recips = keys %recips; @@ -80,10 +81,10 @@ foreach my $row (@$unsent) { my %h = map { $_ => $row->{$_} } qw/title detail name email phone/; $h{phone} = "Phone: $h{phone}\n\n" if $h{phone}; $h{url} = mySociety::Config::get('BASE_URL') . '/?id=' . $row->{id}; - $h{councils_name} = join(' and ', map { $areas_info->{$_}->{name} } @councils); + $h{councils_name} = join(' and ', @dear); $h{fuzzy} = $row->{used_map} ? 'To view a map of the precise location of this issue' : 'The user could not locate the problem on a map, but to see the area around the location they entered'; - $h{multiple} = @councils>1 ? "This email has been sent to both councils covering the location of the problem; please ignore it if you're not the correct council to deal with the issue.\n\n" + $h{multiple} = @dear>1 ? "This email has been sent to both councils covering the location of the problem; please ignore it if you're not the correct council to deal with the issue.\n\n" : ''; $h{closest_address} = ''; |