aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm8
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm6
-rw-r--r--perllib/Open311/GetServiceRequests.pm10
4 files changed, 20 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 5fe513a28..96fe086c3 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -452,6 +452,7 @@ sub body_params : Private {
%defaults = ( %defaults,
send_comments => 0,
fetch_problems => 0,
+ convert_latlong => 0,
blank_updates_permitted => 0,
suppress_alerts => 0,
comment_user_id => undef,
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index df4dc5f77..1646bc4d5 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -475,7 +475,13 @@ sub inspect : Private {
if ($update_text || %update_params) {
my $timestamp = \'current_timestamp';
if (my $saved_at = $c->get_param('saved_at')) {
- $timestamp = DateTime->from_epoch( epoch => $saved_at );
+ # this comes in as a UTC epoch but the database expects everything
+ # to have the FMS timezone so we need to add the timezone otherwise
+ # dates come back out the database at time +/- timezone offset.
+ $timestamp = DateTime->from_epoch(
+ time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone,
+ epoch => $saved_at
+ );
}
my $name = $c->user->from_body ? $c->user->from_body->name : $c->user->name;
$problem->add_to_comments( {
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index a9df1aeb7..0b11f2771 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -47,6 +47,8 @@ __PACKAGE__->add_columns(
"fetch_problems",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"blank_updates_permitted",
+ { data_type => "boolean", default_value => \"false", is_nullable => 1 },
+ "convert_latlong",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
@@ -122,8 +124,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-03-01 12:27:28
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dzqgZI1wkGDPS2PfJgDEIg
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-03-15 12:38:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rturOWpYmPRO0yE9yWHXjA
use Moo;
use namespace::clean;
diff --git a/perllib/Open311/GetServiceRequests.pm b/perllib/Open311/GetServiceRequests.pm
index 2a82c64a1..ed920f84b 100644
--- a/perllib/Open311/GetServiceRequests.pm
+++ b/perllib/Open311/GetServiceRequests.pm
@@ -11,6 +11,7 @@ has start_date => ( is => 'ro', default => sub { undef } );
has end_date => ( is => 'ro', default => sub { undef } );
has verbose => ( is => 'ro', default => 0 );
has schema => ( is =>'ro', lazy => 1, default => sub { FixMyStreet::DB->schema->connect } );
+has convert_latlong => ( is => 'rw', default => 0 );
sub fetch {
my $self = shift;
@@ -33,6 +34,7 @@ sub fetch {
);
$self->system_user( $body->comment_user );
+ $self->convert_latlong( $body->convert_latlong );
$self->create_problems( $o, $body );
}
}
@@ -76,6 +78,10 @@ sub create_problems {
if mySociety::Config::get('MAPIT_GENERATION');
my ($latitude, $longitude) = ( $request->{lat}, $request->{long} );
+
+ ($latitude, $longitude) = Utils::convert_en_to_latlon_truncated( $longitude, $latitude )
+ if $self->convert_latlong;
+
my $all_areas =
mySociety::MaPit::call( 'point',
"4326/$longitude,$latitude", %params );
@@ -146,8 +152,8 @@ sub create_problems {
state => $state,
postcode => '',
used_map => 1,
- latitude => $request->{lat},
- longitude => $request->{long},
+ latitude => $latitude,
+ longitude => $longitude,
areas => ',' . $body->id . ',',
bodies_str => $body->id,
send_method_used => 'Open311',