From 00aadee36735bb75d039943ae54d2c6522fc9a0c Mon Sep 17 00:00:00 2001 From: Edmund von der Burg Date: Wed, 9 Feb 2011 12:28:15 +0000 Subject: Add eastings and northings back into problem report email if in UK --- bin/send-reports | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bin/send-reports') diff --git a/bin/send-reports b/bin/send-reports index 3e6a7fef6..6254337c6 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -27,6 +27,7 @@ use mySociety::Config; use mySociety::DBHandle qw(dbh); use mySociety::Email; use mySociety::EmailUtil; +use mySociety::GeoUtil; use mySociety::Locale; use mySociety::MaPit; use mySociety::Random qw(random_bytes); @@ -97,6 +98,21 @@ foreach my $row (@$unsent) { : _('The user could not locate the problem on a map, but to see the area around the location they entered'); $h{closest_address} = ''; $h{closest_address_machine} = ''; + + # If we are in the UK include eastings and northings + $h{easting_northing} = ''; + if ( mySociety::Config::get('COUNTRY') eq 'GB' ) { + + ( $h{easting}, $h{northing} ) = + mySociety::GeoUtil::wgs84_to_national_grid( # + $h{latitude}, $h{longitude}, 'G' + ); + + # email templates don't have conditionals so we need to farmat this here + $h{easting_northing} # + = "Easting: $h{easting}\n\n" # + . "Northing: $h{northing}\n\n"; + } my (@to, @recips, $template, $areas_info); if ($site eq 'emptyhomes') { -- cgit v1.2.3