aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Stevenage.pm38
-rw-r--r--perllib/FixMyStreet/Map/OSM.pm2
-rw-r--r--perllib/Open311.pm16
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm15
-rw-r--r--perllib/Open311/PopulateServiceList.pm6
7 files changed, 74 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 09149ae14..dedd447ee 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -883,7 +883,7 @@ sub process_report : Private {
$c->cobrand->process_extras( $c, $contacts[0]->area_id, \@extra );
if ( @extra ) {
- $c->stash->{report_meta} = \@extra;
+ $c->stash->{report_meta} = { map { $_->{name} => $_ } @extra };
$report->extra( \@extra );
}
} elsif ( @{ $c->stash->{area_ids_to_list} } ) {
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index a6c9c6fba..6324030b8 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -726,5 +726,7 @@ sub tweak_all_reports_map {}
sub can_support_problems { return 0; }
+sub default_map_zoom { undef };
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/Stevenage.pm b/perllib/FixMyStreet/Cobrand/Stevenage.pm
new file mode 100644
index 000000000..5f6ac81e8
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/Stevenage.pm
@@ -0,0 +1,38 @@
+package FixMyStreet::Cobrand::Stevenage;
+use parent 'FixMyStreet::Cobrand::UKCouncils';
+
+use strict;
+use warnings;
+
+sub council_id { return 2347; }
+sub council_area { return 'Stevenage'; }
+sub council_name { return 'Stevenage Council'; }
+sub council_url { return 'stevenage'; }
+
+sub path_to_web_templates {
+ my $self = shift;
+ return [
+ FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify,
+ FixMyStreet->path_to( 'templates/web/fixmystreet' )->stringify
+ ];
+}
+
+sub disambiguate_location {
+ my $self = shift;
+ return {
+ %{ $self->SUPER::disambiguate_location() },
+ town => 'Stevenage',
+ centre => '51.904330,-0.189364',
+ span => '0.063112,0.087585',
+ bounds => [ 51.869319, -0.234382, 51.932431, -0.146796 ],
+ };
+}
+
+sub example_places {
+ return [ 'SG1 1HN', 'Lyton Way' ];
+}
+
+sub default_map_zoom { return 3; }
+
+1;
+
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm
index 693f42e4f..6b3bebba2 100644
--- a/perllib/FixMyStreet/Map/OSM.pm
+++ b/perllib/FixMyStreet/Map/OSM.pm
@@ -62,7 +62,7 @@ sub display_map {
# Adjust zoom level dependent upon population density
my $dist = $c->stash->{distance}
|| mySociety::Gaze::get_radius_containing_population( $params{latitude}, $params{longitude}, 200_000 );
- my $default_zoom = $numZoomLevels - 3;
+ my $default_zoom = $c->cobrand->default_map_zoom() ? $c->cobrand->default_map_zoom() : $numZoomLevels - 3;
$default_zoom = $numZoomLevels - 2 if $dist < 10;
# Map centre may be overridden in the query string
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index 603eae777..60b658dc3 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -15,7 +15,7 @@ has test_mode => ( is => 'ro', isa => 'Bool' );
has test_uri_used => ( is => 'rw', 'isa' => 'Str' );
has test_req_used => ( is => 'rw' );
has test_get_returns => ( is => 'rw' );
-has endpoints => ( is => 'rw', default => sub { { services => 'services.xml', requests => 'requests.xml', service_request_updates => 'update.xml', update => 'update.xml' } } );
+has endpoints => ( is => 'rw', default => sub { { services => 'services.xml', requests => 'requests.xml', service_request_updates => 'servicerequestupdates.xml', update => 'servicerequestupdates.xml' } } );
has debug => ( is => 'ro', isa => 'Bool', default => 0 );
has debug_details => ( is => 'rw', 'isa' => 'Str', default => '' );
has success => ( is => 'rw', 'isa' => 'Bool', default => 0 );
@@ -24,6 +24,7 @@ has always_send_latlong => ( is => 'ro', isa => 'Bool', default => 1 );
has send_notpinpointed => ( is => 'ro', isa => 'Bool', default => 0 );
has basic_description => ( is => 'ro', isa => 'Bool', default => 0 );
has use_service_as_deviceid => ( is => 'ro', isa => 'Bool', default => 0 );
+has use_extended_updates => ( is => 'ro', isa => 'Bool', default => 0 );
before [
qw/get_service_list get_service_meta_info get_service_requests get_service_request_updates
@@ -283,18 +284,23 @@ sub _populate_service_request_update_params {
my ( $firstname, $lastname ) = ( $name =~ /(\w+)\.?\s+(.+)/ );
my $params = {
- update_id_ext => $comment->id,
updated_datetime => DateTime::Format::W3CDTF->format_datetime($comment->confirmed_local->set_nanosecond(0)),
service_request_id => $comment->problem->external_id,
- service_request_id_ext => $comment->problem->id,
status => $comment->problem->is_open ? 'OPEN' : 'CLOSED',
email => $comment->user->email,
description => $comment->text,
- public_anonymity_required => $comment->anonymous ? 'TRUE' : 'FALSE',
last_name => $lastname,
first_name => $firstname,
};
+ if ( $self->use_extended_updates ) {
+ $params->{public_anonymity_required} = $comment->anonymous ? 'TRUE' : 'FALSE',
+ $params->{update_id_ext} = $comment->id;
+ $params->{service_request_id_ext} = $comment->problem->id;
+ } else {
+ $params->{update_id} = $comment->id;
+ }
+
if ( $comment->photo ) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new();
my $email_base_url = $cobrand->base_url($comment->cobrand_data);
@@ -419,7 +425,7 @@ sub _get_xml_object {
my $obj;
eval {
- $obj = $simple ->parse_string( $xml );
+ $obj = $simple ->parse_string( $xml, ForceArray => [ qr/^key$/, qr/^name$/ ] );
};
return $obj;
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index 6e6e3b905..656fa9d68 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -32,6 +32,13 @@ sub fetch {
jurisdiction => $council->jurisdiction,
);
+ if ( $council->area_id =~ /2482/ ) {
+ my $endpoints = $o->endpoints;
+ $endpoints->{update} = 'update.xml';
+ $endpoints->{service_requests_updates} = 'update.xml';
+ $o->endpoints( $endpoints );
+ }
+
$self->suppress_alerts( $council->suppress_alerts );
$self->system_user( $council->comment_user );
$self->update_comments( $o, { areaid => $council->area_id }, );
@@ -48,6 +55,14 @@ sub update_comments {
push @args, $self->start_date;
push @args, $self->end_date;
+ # default to asking for last 2 hours worth if not Bromley
+ } elsif ( $council_details->{areaid} != 2482 ) {
+ my $end_dt = DateTime->now();
+ my $start_dt = $end_dt->clone;
+ $start_dt->add( hours => -2 );
+
+ push @args, DateTime::Format::W3CDTF->format_datetime( $start_dt );
+ push @args, DateTime::Format::W3CDTF->format_datetime( $end_dt );
}
my $requests = $open311->get_service_request_updates( @args );
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index 788024c89..d8730a703 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -149,6 +149,12 @@ sub _handle_existing_contact {
}
}
+ if ( $contact and lc( $self->_current_service->{metadata} ) eq 'true' ) {
+ $self->_add_meta_to_contact( $contact );
+ } elsif ( $contact and $contact->extra and lc( $self->_current_service->{metadata} ) eq 'false' ) {
+ $contact->update( { extra => undef } );
+ }
+
push @{ $self->found_contacts }, $self->_current_service->{service_code};
}