aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm13
-rw-r--r--perllib/FixMyStreet/Script/Reports.pm16
-rw-r--r--perllib/Open311.pm2
-rw-r--r--t/app/model/problem.t12
-rw-r--r--t/open311.t2
-rw-r--r--templates/email/default/submit.txt2
-rw-r--r--templates/email/fiksgatami/nn/submit.txt2
-rw-r--r--templates/email/fiksgatami/submit.txt2
-rw-r--r--templates/email/fixamingata/submit.txt2
-rw-r--r--templates/email/fixmystreet.com/submit-oxfordshire.txt4
-rw-r--r--templates/email/fixmystreet.com/submit.txt6
-rw-r--r--templates/email/harrogate/submit.txt4
-rw-r--r--templates/email/oxfordshire/submit.txt4
-rw-r--r--templates/email/seesomething/submit.txt4
-rw-r--r--templates/web/base/admin/report_edit.html11
15 files changed, 48 insertions, 38 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 5b853134e..628497233 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -160,6 +160,7 @@ __PACKAGE__->rabx_column('geocode');
use Moo;
use namespace::clean -except => [ 'meta' ];
use Utils;
+use FixMyStreet::Map::FMS;
with 'FixMyStreet::Roles::Abuser',
'FixMyStreet::Roles::Extra';
@@ -672,13 +673,15 @@ sub duration_string {
sub local_coords {
my $self = shift;
- if ($self->cobrand eq 'zurich') {
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($self->cobrand)->new;
+ if ($cobrand->moniker eq 'zurich') {
my ($x, $y) = Geo::Coordinates::CH1903::from_latlon($self->latitude, $self->longitude);
return ( int($x+0.5), int($y+0.5) );
- }
- else {
- # return a dummy value until this function is implemented. useful for testing.
- return (0, 0);
+ } elsif ($cobrand->country eq 'GB') {
+ my $coordsyst = 'G';
+ $coordsyst = 'I' if FixMyStreet::Map::FMS::in_northern_ireland_box($self->latitude, $self->longitude);
+ my ($x, $y) = Utils::convert_latlon_to_en( $self->latitude, $self->longitude, $coordsyst );
+ return ($x, $y, $coordsyst);
}
}
diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm
index 278c58af1..30d24f640 100644
--- a/perllib/FixMyStreet/Script/Reports.pm
+++ b/perllib/FixMyStreet/Script/Reports.pm
@@ -108,8 +108,6 @@ sub send(;$) {
$h{user_details} .= sprintf(_('Email: %s'), $row->user->email) . "\n\n";
}
- $h{easting_northing} = '';
-
if ($cobrand->can('process_additional_metadata_for_email')) {
$cobrand->process_additional_metadata_for_email($row, \%h);
}
@@ -150,19 +148,9 @@ sub send(;$) {
$reporters{ $sender }->add_body( $body, $sender_info->{config} );
}
- # If we are in the UK include eastings and northings, and nearest stuff
+ # If we are in the UK include eastings and northings
if ( $cobrand->country eq 'GB' && !$h{easting} ) {
- my $coordsyst = 'G';
- my $first_area = $body->body_areas->first->area_id;
- my $area_info = mySociety::MaPit::call('area', $first_area);
- $coordsyst = 'I' if $area_info->{type} eq 'LGD';
-
- ( $h{easting}, $h{northing} ) = Utils::convert_latlon_to_en( $h{latitude}, $h{longitude}, $coordsyst );
-
- # email templates don't have conditionals so we need to format this here
- $h{easting_northing} = "Easting/Northing";
- $h{easting_northing} .= " (IE)" if $coordsyst eq 'I';
- $h{easting_northing} .= ": $h{easting}/$h{northing}\n\n";
+ ( $h{easting}, $h{northing}, $h{coordsyst} ) = $row->local_coords;
}
}
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index 6434be1fb..69c946004 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -166,7 +166,7 @@ sub _generate_service_request_description {
my $extra = shift;
my $description = "";
- if ($extra->{easting_northing}) { # Proxy for cobrand being in the UK
+ if ($extra->{easting}) { # Proxy for cobrand being in the UK
$description .= "detail: " . $problem->detail . "\n\n";
$description .= "url: " . $extra->{url} . "\n\n";
$description .= "Submitted via FixMyStreet\n";
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 4e4a098d7..ea45f7356 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -16,8 +16,8 @@ my $problem_rs = FixMyStreet::DB->resultset('Problem');
my $problem = $problem_rs->new(
{
postcode => 'EH99 1SP',
- latitude => '51.5',
- longitude => '-0.1',
+ latitude => '54.5',
+ longitude => '-1.5',
areas => 1,
title => '',
detail => '',
@@ -487,7 +487,7 @@ foreach my $test ( {
to => qr'Ballymoney Borough Council',
body => $body_ids{14279}[0],
category => 'Graffiti',
- longitude => -9.5,
+ longitude => -6.5,
}, {
%common,
desc => 'directs NI correctly, 2',
@@ -497,7 +497,7 @@ foreach my $test ( {
to => qr'TransportNI \(Western\)" <roads',
body => $body_ids{14279}[1],
category => 'Street lighting',
- longitude => -9.5,
+ longitude => -6.5,
}, {
%common,
desc => 'does not send to unconfirmed contact',
@@ -535,7 +535,7 @@ foreach my $test ( {
category => $test->{ category } || 'potholes',
name => $test->{ name },
cobrand => $test->{ cobrand } || 'fixmystreet',
- longitude => $test->{longitude} || '-0.1',
+ longitude => $test->{longitude} || '-1.5',
} );
FixMyStreet::override_config $override, sub {
@@ -552,7 +552,7 @@ foreach my $test ( {
like $email->body, qr/Subject: A Title/, 'more email body checking';
like $email->body, $test->{ dear }, 'Salutation looks correct';
if ($test->{longitude}) {
- like $email->body, qr{Easting/Northing \(IE\): 95938/28531};
+ like $email->body, qr{Easting/Northing \(IE\): 297279/362371};
} else {
like $email->body, qr{Easting/Northing: };
}
diff --git a/t/open311.t b/t/open311.t
index 42d09b29c..cbf305a36 100644
--- a/t/open311.t
+++ b/t/open311.t
@@ -69,7 +69,7 @@ my $problem = FixMyStreet::DB->resultset('Problem')->new( {
subtest 'posting service request' => sub {
my $extra = {
url => 'http://example.com/report/1',
- easting_northing => 'SET',
+ easting => 'SET',
};
my $results = make_service_req( $problem, $extra, $problem->category, '<?xml version="1.0" encoding="utf-8"?><service_requests><request><service_request_id>248</service_request_id></request></service_requests>' );
diff --git a/templates/email/default/submit.txt b/templates/email/default/submit.txt
index 3b6549d8e..5d79f3b41 100644
--- a/templates/email/default/submit.txt
+++ b/templates/email/default/submit.txt
@@ -21,7 +21,7 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fiksgatami/nn/submit.txt b/templates/email/fiksgatami/nn/submit.txt
index c3468a085..32a895632 100644
--- a/templates/email/fiksgatami/nn/submit.txt
+++ b/templates/email/fiksgatami/nn/submit.txt
@@ -21,7 +21,7 @@ E-post: [% email %]
Detaljer: [% detail %]
-[% easting_northing %]Breiddegrad: [% latitude %]
+Breiddegrad: [% latitude %]
Lengdegrad: [% longitude %]
diff --git a/templates/email/fiksgatami/submit.txt b/templates/email/fiksgatami/submit.txt
index d149f7f04..a0e0687eb 100644
--- a/templates/email/fiksgatami/submit.txt
+++ b/templates/email/fiksgatami/submit.txt
@@ -21,7 +21,7 @@ E-post: [% email %]
Detajer: [% detail %]
-[% easting_northing %]Breddegrad: [% latitude %]
+Breddegrad: [% latitude %]
Lengegrad: [% longitude %]
diff --git a/templates/email/fixamingata/submit.txt b/templates/email/fixamingata/submit.txt
index 4704cbd56..009ac9c6a 100644
--- a/templates/email/fixamingata/submit.txt
+++ b/templates/email/fixamingata/submit.txt
@@ -28,7 +28,7 @@ ID: [% id %]
** Geografisk position
-[% easting_northing %]Latitude: [% latitude %]
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fixmystreet.com/submit-oxfordshire.txt b/templates/email/fixmystreet.com/submit-oxfordshire.txt
index f0fc5e9b7..547f7ce7f 100644
--- a/templates/email/fixmystreet.com/submit-oxfordshire.txt
+++ b/templates/email/fixmystreet.com/submit-oxfordshire.txt
@@ -21,7 +21,9 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/fixmystreet.com/submit.txt b/templates/email/fixmystreet.com/submit.txt
index 17642e645..735fdf37d 100644
--- a/templates/email/fixmystreet.com/submit.txt
+++ b/templates/email/fixmystreet.com/submit.txt
@@ -21,7 +21,11 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing
+[%- " (IE)" IF coordsyst == "I" -%]
+: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/harrogate/submit.txt b/templates/email/harrogate/submit.txt
index 7f9357cf8..a4dcd5220 100644
--- a/templates/email/harrogate/submit.txt
+++ b/templates/email/harrogate/submit.txt
@@ -21,7 +21,9 @@ Email: [% email %]
[% detail %] [% additional_information %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/oxfordshire/submit.txt b/templates/email/oxfordshire/submit.txt
index f0fc5e9b7..547f7ce7f 100644
--- a/templates/email/oxfordshire/submit.txt
+++ b/templates/email/oxfordshire/submit.txt
@@ -21,7 +21,9 @@ Email: [% email %]
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/email/seesomething/submit.txt b/templates/email/seesomething/submit.txt
index e1c048e15..1f2adc11d 100644
--- a/templates/email/seesomething/submit.txt
+++ b/templates/email/seesomething/submit.txt
@@ -13,7 +13,9 @@ of a problem that they believe might require your attention.
Details: [% detail %]
-[% easting_northing %]Latitude: [% latitude %]
+Easting/Northing: [% easting %]/[% northing %]
+
+Latitude: [% latitude %]
Longitude: [% longitude %]
diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html
index 065c6c2ce..20ed25c21 100644
--- a/templates/web/base/admin/report_edit.html
+++ b/templates/web/base/admin/report_edit.html
@@ -25,11 +25,18 @@
'/' UNLESS c.config.MAPIT_URL.search('/$')
%]point/4326/[% problem.longitude %],[% problem.latitude %].html"
class="admin-offsite-link">[% problem.latitude %], [% problem.longitude %]</a>
-( [%
+
+[% SET local_coords = problem.local_coords;
+ IF local_coords %]
+ ([% local_coords.0 %], [% local_coords.1 %])
+[% END %]
+
+([%
SET postcode_safe = problem.postcode | html;
tprintf( loc('originally entered: &ldquo;%s&rdquo;'), postcode_safe )
%],
-[% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li>
+[% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])
+</li>
<li>[% loc('Body:') %]
[% IF problem.bodies_str %]