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 send_questionnaires { 0 } 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_config' => sub { my ($orig, $self, $row, $h, $params) = @_; # remove the emergency category which is informational only my $extra = $row->get_extra_fields; @$extra = grep { $_->{name} ne 'emergency' } @$extra; $row->set_extra_fields(@$extra); $self->$orig($row, $h, $params); }; 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}; } sub categories_restriction { my ($self, $rs) = @_; # Categories covering Peterborough have a mixture of Open311 and Email # send methods. Peterborough only want specific categories to be visible on # their cobrand, not the email categories from FMS.com. # The FMS.com categories have a devolved send_method set to Email, so we can # filter these out. return $rs->search( { -or => [ 'me.send_method' => undef, # Open311 categories 'me.send_method' => '', # Open311 categories that have been edited in the admin ] } ); } 1;