diff options
author | matthew <matthew> | 2007-05-11 09:02:53 +0000 |
---|---|---|
committer | matthew <matthew> | 2007-05-11 09:02:53 +0000 |
commit | d913928d3b23d843b6502cdb1ff70ab0c8f3bd72 (patch) | |
tree | 5f93087b9635c96f25bb67cb295282cb91ad0450 /bin/send-reports | |
parent | 8ec398cee5d2651b0f512bfb46756097f5edca76 (diff) |
Deal with Essex special case.
Diffstat (limited to 'bin/send-reports')
-rwxr-xr-x | bin/send-reports | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/send-reports b/bin/send-reports index cdfbc4616..06aef0d4b 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.36 2007-05-09 15:13:27 matthew Exp $ +# $Id: send-reports,v 1.37 2007-05-11 09:02:53 matthew Exp $ use strict; require 5.8.0; @@ -63,6 +63,7 @@ foreach my $row (@$unsent) { 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}); + $council_email = essex_contact($row->{easting}, $row->{northing}) if $council == 2225; unless ($confirmed) { $all_confirmed = 0; $note = 'Council ' . $row->{council} . ' deleted' @@ -145,3 +146,19 @@ if ($verbose) { } } } + +# Essex has different contact addresses depending upon the district +# Might be easier if we start storing in the db all areas covered by a point +# Will do for now :) +sub essex_contact { + my ($E, $N) = @_; + my $district = mySociety::MaPit::get_voting_area_by_location_en($E, $N, 'polygon', 'DIS'); + $district = $district->[0]; + my $email; + $email = 'eastarea' if $district == 2315 || $district == 2312; + $email = 'midarea' if $district == 2317 || $district == 2314 || $district == 2316; + $email = 'southarea' if $district == 2319 || $district == 2320 || $district == 2310; + $email = 'westarea' if $district == 2309 || $district == 2311 || $district == 2318 || $district == 2313; + die "Returned district $district which is not in Essex!" unless $email; + return "highways.$email\@essexcc.gov.uk"; +} |