diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 20 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/MakeMyIsland.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 57 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 27 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Open311.pm | 3 |
7 files changed, 67 insertions, 56 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 866f1f462..787755a05 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -560,7 +560,8 @@ sub get_param_list { my ($c, $param) = @_; my $value = $c->req->params->{$param}; return @$value if ref $value; - return ($value); + return ($value) if defined $value; + return (); } =head2 set_param diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index abb858c32..114a2e19f 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -253,12 +253,9 @@ sub bodies : Path('bodies') : Args(0) { my $params = $c->forward('body_params'); my $body = $c->model('DB::Body')->create( $params ); - my $area_ids = $c->get_param('area_ids'); - if ($area_ids) { - $area_ids = [ $area_ids ] unless ref $area_ids; - foreach (@$area_ids) { - $c->model('DB::BodyArea')->create( { body => $body, area_id => $_ } ); - } + my @area_ids = $c->get_param_list('area_ids'); + foreach (@area_ids) { + $c->model('DB::BodyArea')->create( { body => $body, area_id => $_ } ); } $c->stash->{updated} = _('New body added'); @@ -413,13 +410,10 @@ sub update_contacts : Private { $c->stash->{body}->update( $params ); my @current = $c->stash->{body}->body_areas->all; my %current = map { $_->area_id => 1 } @current; - my $area_ids = $c->get_param('area_ids'); - if ($area_ids) { - $area_ids = [ $area_ids ] unless ref $area_ids; - foreach (@$area_ids) { - $c->model('DB::BodyArea')->find_or_create( { body => $c->stash->{body}, area_id => $_ } ); - delete $current{$_}; - } + my @area_ids = $c->get_param_list('area_ids'); + foreach (@area_ids) { + $c->model('DB::BodyArea')->find_or_create( { body => $c->stash->{body}, area_id => $_ } ); + delete $current{$_}; } # Remove any others $c->stash->{body}->body_areas->search( { area_id => [ keys %current ] } )->delete; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 9f44ca758..c3185ea05 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -922,4 +922,3 @@ sub jurisdiction_id_example { } 1; - diff --git a/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm b/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm deleted file mode 100644 index f263df4cc..000000000 --- a/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm +++ /dev/null @@ -1,12 +0,0 @@ -package FixMyStreet::Cobrand::MakeMyIsland; -use base 'FixMyStreet::Cobrand::Default'; - -use strict; -use warnings; - -sub country { - return 'MV'; -} - -1; - diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 44b3a0fa9..b9d48a95c 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -47,5 +47,60 @@ sub users_can_hide { return 1; } sub default_show_name { 0 } -1; +=head2 problem_response_days + +Returns the number of working days that are expected to elapse +between the problem being reported and it being responded to by +the council/body. + +=cut + +sub problem_response_days { + my $self = shift; + my $p = shift; + + return 10 if $p->category eq 'Bridges'; + return 10 if $p->category eq 'Carriageway Defect'; # phone if urgent + return 10 if $p->category eq 'Debris/Spillage'; + return 10 if $p->category eq 'Drainage'; + return 10 if $p->category eq 'Fences'; + return 10 if $p->category eq 'Flyposting'; + return 10 if $p->category eq 'Footpaths/ Rights of way (usually not tarmac)'; + return 10 if $p->category eq 'Gully and Catchpits'; + return 10 if $p->category eq 'Ice/Snow'; # phone if urgent + return 10 if $p->category eq 'Manhole'; + return 10 if $p->category eq 'Mud and Debris'; # phone if urgent + return 10 if $p->category eq 'Oil Spillage'; # phone if urgent + return 10 if $p->category eq 'Pavements'; + return 10 if $p->category eq 'Pothole'; # phone if urgent + return 10 if $p->category eq 'Property Damage'; + return 10 if $p->category eq 'Public rights of way'; + return 10 if $p->category eq 'Road Marking'; + return 10 if $p->category eq 'Road traffic signs'; + return 10 if $p->category eq 'Roads/highways'; + return 10 if $p->category eq 'Skips and scaffolding'; + return 10 if $p->category eq 'Street lighting'; + return 10 if $p->category eq 'Traffic lights'; # phone if urgent + return 10 if $p->category eq 'Traffic'; + return 10 if $p->category eq 'Trees'; + return 10 if $p->category eq 'Utilities'; + return 10 if $p->category eq 'Vegetation'; + + return undef; +} +sub reports_ordering { + return { -desc => 'confirmed' }; +} + +sub pin_colour { + my ( $self, $p, $context ) = @_; + return 'grey' if $p->state eq 'not responsible'; + return 'green' if $p->is_fixed || $p->is_closed; + return 'red' if $p->state eq 'confirmed'; + return 'yellow'; +} + +sub on_map_default_status { return 'open'; } + +1; diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 4507091c7..fa4d437fb 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -18,9 +18,6 @@ sub build_recipient_list { my ($body_email, $confirmed, $note) = ( $contact->email, $contact->confirmed, $contact->note ); - $body_email = essex_contact($row->latitude, $row->longitude) if $body->areas->{2225}; - $body_email = oxfordshire_contact($row->latitude, $row->longitude) if $body->areas->{2237} && $body_email eq 'SPECIAL'; - unless ($confirmed) { $all_confirmed = 0; $note = 'Body ' . $row->bodies_str . ' deleted' @@ -112,30 +109,6 @@ sub send { return $result; } -# Essex has different contact addresses depending upon the district -# Might be easier if we start storing in the db all areas covered by a point -# Will do for now :) -sub essex_contact { - my $district = _get_district_for_contact(@_); - my $email; - $email = 'eastarea' if $district == 2315 || $district == 2312; - $email = 'midarea' if $district == 2317 || $district == 2314 || $district == 2316; - $email = 'southarea' if $district == 2319 || $district == 2320 || $district == 2310; - $email = 'westarea' if $district == 2309 || $district == 2311 || $district == 2318 || $district == 2313; - die "Returned district $district which is not in Essex!" unless $email; - return "highways.$email\@essexcc.gov.uk"; -} - -# Oxfordshire has different contact addresses depending upon the district -sub oxfordshire_contact { - my $district = _get_district_for_contact(@_); - my $email; - $email = 'northernarea' if $district == 2419 || $district == 2420 || $district == 2421; - $email = 'southernarea' if $district == 2417 || $district == 2418; - die "Returned district $district which is not in Oxfordshire!" unless $email; - return "$email\@oxfordshire.gov.uk"; -} - sub _get_district_for_contact { my ( $lat, $lon ) = @_; my $district = diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index cfcac9bd8..fa216466e 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -13,6 +13,7 @@ use Readonly; Readonly::Scalar my $COUNCIL_ID_OXFORDSHIRE => 2237; Readonly::Scalar my $COUNCIL_ID_WARWICKSHIRE => 2243; +Readonly::Scalar my $COUNCIL_ID_GREENWICH => 2493; sub send { my $self = shift; @@ -127,7 +128,7 @@ sub send { $revert = 1; } - if ($row->cobrand eq 'fixmybarangay' || $row->cobrand eq 'greenwich') { + if ($row->cobrand eq 'fixmybarangay' || $row->bodies_str =~ /$COUNCIL_ID_GREENWICH/) { # FixMyBarangay endpoints expect external_id as an attribute, as do Greenwich $row->set_extra_fields( { 'name' => 'external_id', 'value' => $row->id } ); $revert = 1; |