diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 18:06:55 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-03-13 21:54:29 +0000 |
commit | d0a16157fbd10f8bdf1a07c77331504c61bf7f5d (patch) | |
tree | f0401ba3397536b02a0d63eafdec4c8fda4bcf38 /perllib | |
parent | 76e533bd318cb4208faa1bf5cd0c00bde9e08e6c (diff) |
[fixmystreet.com] Remove special Report-It code.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 22 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/London.pm | 113 | ||||
-rw-r--r-- | perllib/Utils.pm | 29 |
5 files changed, 0 insertions, 168 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index de13a76de..790e22e8c 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -266,9 +266,6 @@ sub bodies : Path('bodies') : Args(0) { $c->forward( 'fetch_all_bodies' ); - # XXX For fixmystreet.com, need to exclude bodies that are covering London. - # But soon, this means just don't have bodies covering London. - my $contacts = $c->model('DB::Contact')->search( undef, { diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 5021d90e0..ee643a03a 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -74,7 +74,6 @@ partial =cut -use constant COUNCIL_ID_BARNET => 2489; use constant COUNCIL_ID_BROMLEY => 2482; sub report_new : Path : Args(0) { @@ -624,18 +623,6 @@ sub setup_categories_and_bodies : Private { _('Empty public building - school, hospital, etc.') ); - } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY - && $first_area->{id} != COUNCIL_ID_BARNET - && $first_area->{type} eq 'LBO') { - - $bodies_to_list{ $first_body->id } = 1; - my @local_categories; - @local_categories = sort keys %{ Utils::london_categories() }; - @category_options = ( - _('-- Pick a category --'), - @local_categories - ); - } else { # keysort does not appear to obey locale so use strcoll (see i18n.t) @@ -851,15 +838,6 @@ sub process_report : Private { $report->extra( \%extra ); } - } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY - && $first_area->{id} != COUNCIL_ID_BARNET - && $first_area->{type} eq 'LBO') { - - unless ( Utils::london_categories()->{ $report->category } ) { - $c->stash->{field_errors}->{category} = _('Please choose a category'); - } - $report->bodies_str( $first_body->id ); - } elsif ( $report->category ) { # FIXME All contacts were fetched in setup_categories_and_bodies, diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index 786b6038c..33d3b4253 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -31,7 +31,6 @@ sub _fallback_body_sender { my $first_area = $body->body_areas->first->area_id; my $area_info = mySociety::MaPit::call('area', $first_area); - return { method => 'London' } if $area_info->{type} eq 'LBO'; return { method => 'NI' } if $area_info->{type} eq 'LGD'; return { method => 'Email' }; } diff --git a/perllib/FixMyStreet/SendReport/London.pm b/perllib/FixMyStreet/SendReport/London.pm deleted file mode 100644 index 2a1ebc1c3..000000000 --- a/perllib/FixMyStreet/SendReport/London.pm +++ /dev/null @@ -1,113 +0,0 @@ -package FixMyStreet::SendReport::London; - -use Moose; - -BEGIN { extends 'FixMyStreet::SendReport'; } - -use Digest::MD5; -use FindBin; -use LWP::UserAgent; -use LWP::Simple; - -use Utils; - -sub construct_message { - my %h = @_; - return <<EOF, -A user of FixMyStreet has submitted the following report of a local -problem that they believe might require your attention. - -Subject: $h{title} - -Details: $h{detail} - -$h{fuzzy}, or to provide an update on the problem, please visit the -following link: - -$h{url} - -$h{closest_address} -Yours, -The FixMyStreet team -EOF -} - -sub send { - return if mySociety::Config::get('STAGING_SITE'); - my ( $self, $row, $h ) = @_; - - $h->{message} = construct_message( %$h ); - my $phone = $h->{phone}; - my $mobile = ''; - if ($phone && $phone =~ /^\s*07/) { - $mobile = $phone; - $phone = ''; - } - my ($first, $last) = $h->{name} =~ /^(\S*)(?: (.*))?$/; - my %params = ( - Key => mySociety::Config::get('LONDON_REPORTIT_KEY'), - Signature => Digest::MD5::md5_hex( $h->{confirmed} . mySociety::Config::get('LONDON_REPORTIT_SECRET') ), - Type => Utils::london_categories()->{$h->{category}}, - RequestDate => $h->{confirmed}, - RequestMethod => 'Web', - ExternalId => $h->{url}, - 'Customer.Title' => '', - 'Customer.FirstName' => $first, - 'Customer.Surname' => $last, - 'Customer.Email' => $h->{email}, - 'Customer.Phone' => $phone, - 'Customer.Mobile' => $mobile, - 'ProblemDescription' => $h->{message}, - ); - if ($h->{used_map}) { - $params{'Location.Latitude'} = $h->{latitude}; - $params{'Location.Longitude'} = $h->{longitude}; - } elsif (mySociety::PostcodeUtil::is_valid_postcode($h->{query})) { - # Didn't use map, and entered postcode, so use that. - $params{'Location.Postcode'} = $h->{query}; - } else { - # Otherwise, lat/lon is all we have, even if it's wrong. - $params{'Location.Latitude'} = $h->{latitude}; - $params{'Location.Longitude'} = $h->{longitude}; - } - if ($h->{has_photo}) { - $params{'Document1.Name'} = 'Photograph'; - $params{'Document1.MimeType'} = 'image/jpeg'; - $params{'Document1.URL'} = $h->{image_url}; - $params{'Document1.URLPublic'} = 'true'; - } - my $browser = LWP::UserAgent->new; - my $response = $browser->post( mySociety::Config::get('LONDON_REPORTIT_URL'), \%params ); - my $out = $response->content; - if ($response->code ne 200) { - $self->error( "Failed to post $h->{id} to London API, response was " . $response->code . " $out" ); - return 1; - } - my ($id) = $out =~ /<caseid>(.*?)<\/caseid>/; - my ($org) = $out =~ /<organisation>(.*?)<\/organisation>/; - my ($team) = $out =~ /<team>(.*?)<\/team>/; - - $org = london_lookup($org); - $row->external_id( $id ); - $row->external_body( $org ); - $row->external_team( $team ); - $self->success(1); - return 0; -} - -sub london_lookup { - my $org = shift || ''; - my $str = "Unknown ($org)"; - open(FP, "$FindBin::Bin/../data/dft.csv"); - while (<FP>) { - /^(.*?),(.*)/; - if ($org eq $1) { - $str = $2; - last; - } - } - close FP; - return $str; -} - -1; diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 243b98800..21a7311f2 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -91,35 +91,6 @@ sub truncate_coordinate { return $out; } -sub london_categories { - return { - 'Abandoned vehicle' => 'AbandonedVehicle', - 'Car parking' => 'Parking', - 'Dangerous structure' => 'DangerousStructure', - 'Dead animal' => 'DeadAnimal', - 'Dumped cylinder' => 'DumpedCylinder', - 'Dumped rubbish' => 'DumpedRubbish', - 'Flyposting' => 'FlyPosting', - 'Graffiti' => 'Graffiti', - 'Litter bin' => 'LitterBin', - 'Public toilet' => 'PublicToilet', - 'Refuse collection' => 'RefuseCollection', - 'Road or pavement defect' => 'Road', - 'Road or pavement obstruction' => 'Obstruction', - 'Skip problem' => 'Skip', - 'Street cleaning' => 'StreetCleaning', - 'Street drainage' => 'StreetDrainage', - 'Street furniture' => 'StreetFurniture', - 'Street needs gritting' => 'StreetGritting', - 'Street lighting' => 'StreetLighting', - 'Street sign' => 'StreetSign', - 'Traffic light' => 'TrafficLight', - 'Tree (dangerous)' => 'DangerousTree', - 'Tree (fallen branches)' => 'FallenTree', - 'Untaxed vehicle' => 'UntaxedVehicle', - }; -} - sub barnet_categories { # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting. # They are no longer used since Barnet switched to email for delivery of problem reports. |