diff options
-rwxr-xr-x | bin/send-reports | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/send-reports b/bin/send-reports index 7ac596876..02d1d1630 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.29 2007-03-23 09:50:29 matthew Exp $ +# $Id: send-reports,v 1.30 2007-03-26 17:00:12 matthew Exp $ use strict; require 5.8.0; @@ -40,7 +40,7 @@ die "No arguments or specify --nomail" if (@ARGV>1); my $nomail = 0; $nomail = 1 if (@ARGV==1 && $ARGV[0] eq '--nomail'); -my %notgot; +my (%notgot, %note); my $unsent = dbh()->selectall_arrayref( "SELECT id, council, category, title, detail, name, email, phone, used_map, easting, northing @@ -57,13 +57,14 @@ foreach my $row (@$unsent) { 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' + my ($council_email, $confirmed, $note) = dbh()->selectrow_array( + "SELECT email,confirmed,note FROM contacts WHERE deleted='f' 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}++; + $notgot{$council_email}{$row->{category}}++; + $note{$council_email}{$row->{category}} = $note; } push @to, [ $council_email, $name ]; push @dear, $name; @@ -129,6 +130,8 @@ If you know of an appropriate contact address, please do get in touch. ]\n\n"; } print "Council email addresses that need checking:\n"; -foreach (keys %notgot) { - print $notgot{$_} . ' ' . $_ . "\n"; +foreach my $e (keys %notgot) { + foreach my $c (keys %{$notgot{$e}}) { + print $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; + } } |