/
Peterborough.pm
99 lines (77 loc) · 2.74 KB
/
Peterborough.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package FixMyStreet::Cobrand::Peterborough;
use parent 'FixMyStreet::Cobrand::Whitelabel';
use strict;
use warnings;
use Moo;
with 'FixMyStreet::Roles::ConfirmOpen311';
with 'FixMyStreet::Roles::ConfirmValidation';
sub council_area_id { 2566 }
sub council_area { 'Peterborough' }
sub council_name { 'Peterborough City Council' }
sub council_url { 'peterborough' }
sub map_type { 'MasterMap' }
sub send_questionnaires { 0 }
sub max_title_length { 50 }
sub disambiguate_location {
my $self = shift;
my $string = shift;
return {
%{ $self->SUPER::disambiguate_location() },
centre => '52.6085234396978,-0.253091266573947',
bounds => [ 52.5060949603654, -0.497663559599628, 52.6752139533306, -0.0127696975457487 ],
};
}
sub get_geocoder { 'OSM' }
sub geocoder_munge_results {
my ($self, $result) = @_;
$result->{display_name} = '' unless $result->{display_name} =~ /City of Peterborough/;
$result->{display_name} =~ s/, UK$//;
$result->{display_name} =~ s/, City of Peterborough, East of England, England//;
}
sub admin_user_domain { "peterborough.gov.uk" }
around open311_extra_data => sub {
my ($orig, $self, $row, $h, $extra) = @_;
my $open311_only = $self->$orig($row, $h, $extra);
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;
}
}
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 lookup_site_code_config { {
buffer => 50, # metres
url => "https://tilma.mysociety.org/mapserver/peterborough",
srsname => "urn:ogc:def:crs:EPSG::27700",
typename => "highways",
property => "Usrn",
accept_feature => sub { 1 },
accept_types => { Polygon => 1 },
} }
sub open311_munge_update_params {
my ($self, $params, $comment, $body) = @_;
# Peterborough want to make it clear in Confirm when an update has come
# from FMS.
$params->{description} = "[Customer FMS update] " . $params->{description};
# Send the FMS problem ID with the update.
$params->{service_request_id_ext} = $comment->problem->id;
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);
};
1;