aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/Peterborough.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Peterborough.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/Peterborough.pm61
1 files changed, 46 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm
index 0ddaeacb6..b10367cfd 100644
--- a/perllib/FixMyStreet/Cobrand/Peterborough.pm
+++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm
@@ -13,6 +13,7 @@ sub council_area { 'Peterborough' }
sub council_name { 'Peterborough City Council' }
sub council_url { 'peterborough' }
sub map_type { 'MasterMap' }
+sub default_map_zoom { 5 }
sub send_questionnaires { 0 }
@@ -31,6 +32,8 @@ sub disambiguate_location {
sub get_geocoder { 'OSM' }
+sub contact_extra_fields { [ 'display_name' ] }
+
sub geocoder_munge_results {
my ($self, $result) = @_;
$result->{display_name} = '' unless $result->{display_name} =~ /City of Peterborough/;
@@ -40,30 +43,29 @@ sub geocoder_munge_results {
sub admin_user_domain { "peterborough.gov.uk" }
-around open311_extra_data => sub {
- my ($orig, $self, $row, $h, $extra) = @_;
+around open311_extra_data_include => sub {
+ my ($orig, $self, $row, $h) = @_;
- my $open311_only = $self->$orig($row, $h, $extra);
+ my $open311_only = $self->$orig($row, $h);
foreach (@$open311_only) {
if ($_->{name} eq 'description') {
my ($ref) = grep { $_->{name} =~ /pcc-Skanska-csc-ref/i } @{$row->get_extra_fields};
$_->{value} .= "\n\nSkanska CSC ref: $ref->{value}" if $ref;
}
}
+ if ( $row->geocode && $row->contact->email =~ /Bartec/ ) {
+ my $address = $row->geocode->{resourceSets}->[0]->{resources}->[0]->{address};
+ my ($number, $street) = $address->{addressLine} =~ /\s*(\d*)\s*(.*)/;
+ push @$open311_only, (
+ { name => 'postcode', value => $address->{postalCode} },
+ { name => 'house_no', value => $number },
+ { name => 'street', value => $street }
+ );
+ }
return $open311_only;
};
-
# remove categories which are informational only
-sub open311_pre_send {
- my ($self, $row, $open311) = @_;
-
- return unless $row->extra;
- my $extra = $row->get_extra_fields;
- if (@$extra) {
- @$extra = grep { $_->{name} !~ /^(PCC-|emergency$|private_land$)/i } @$extra;
- $row->set_extra_fields(@$extra);
- }
-}
+sub open311_extra_data_exclude { [ '^PCC-', '^emergency$', '^private_land$' ] }
sub lookup_site_code_config { {
buffer => 50, # metres
@@ -85,8 +87,37 @@ sub open311_munge_update_params {
# Send the FMS problem ID with the update.
$params->{service_request_id_ext} = $comment->problem->id;
- my $contact = $comment->problem->category_row;
+ my $contact = $comment->problem->contact;
$params->{service_code} = $contact->email;
}
+around 'open311_config' => sub {
+ my ($orig, $self, $row, $h, $params) = @_;
+
+ $params->{upload_files} = 1;
+ $self->$orig($row, $h, $params);
+};
+
+sub dashboard_export_problems_add_columns {
+ my ($self, $csv) = @_;
+
+ $csv->add_csv_columns(
+ usrn => 'USRN',
+ nearest_address => 'Nearest address',
+ );
+
+ $csv->csv_extra_data(sub {
+ my $report = shift;
+
+ my $address = '';
+ $address = $report->geocode->{resourceSets}->[0]->{resources}->[0]->{name}
+ if $report->geocode;
+
+ return {
+ usrn => $report->get_extra_field_value('site_code'),
+ nearest_address => $address,
+ };
+ });
+}
+
1;