aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-04 17:14:36 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-04 17:14:36 +0000
commitbe1d7f07903d7291dde8da19f78935233e383597 (patch)
tree3c3fc912a3c3a51f193917d9d6667a504f432e2a
parentcef6a4660efcf95c7d77cdf76facf186d051f184 (diff)
Remove all special body handling in order to move FMB to use bodies properly.
-rwxr-xr-xbin/send-comments6
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm16
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm9
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyBarangay.pm2
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm13
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm10
6 files changed, 8 insertions, 48 deletions
diff --git a/bin/send-comments b/bin/send-comments
index 4f654fe20..fb81d76e9 100755
--- a/bin/send-comments
+++ b/bin/send-comments
@@ -2,7 +2,7 @@
# send-comments:
# Send comments/updates on reports to bodies
-# In Open311 parlance these are 'service request udpates' and are sent using
+# In Open311 parlance these are 'service request updates' and are sent using
# mySociety's proposed extension to the Open311 Georeport v2 spec:
# https://github.com/mysociety/fixmystreet/wiki/Open311-FMS---Proposed-differences-to-Open311
#
@@ -95,8 +95,8 @@ while ( my $body = $bodies->next ) {
while ( my $comment = $comments->next ) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($comment->cobrand)->new();
- # actually this should be OK for any devolved endpoint if original Open311->can_be_devolved, presumably
- if ( $cobrand->moniker eq "fixmybarangay") {
+ # TODO actually this should be OK for any devolved endpoint if original Open311->can_be_devolved, presumably
+ if ( 0 ) { # Check can_be_devolved and do this properly if set
my $sender = $cobrand->get_body_sender( $body, $comment->problem->category );
my $config = $sender->{config};
$o = Open311->new(
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index a4dcaeeb8..bbb60f4e7 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -131,7 +131,6 @@ sub ward : Path : Args(2) {
$c->cobrand->tweak_all_reports_map( $c );
# List of wards
- # Ignore external_body special body thing
if ( !$c->stash->{ward} && $c->stash->{body}->id && $c->stash->{body}->body_areas->first ) {
my $children = mySociety::MaPit::call('area/children', [ $c->stash->{body}->body_areas->first->area_id ],
type => $c->cobrand->area_types_children,
@@ -285,15 +284,6 @@ sub body_check : Private {
$c->detach( 'redirect_body' );
}
- if ( $c->cobrand->reports_by_body ) {
- my $problem = $c->cobrand->problems->search({ 'lower(me.external_body)' => lc $q_body }, { columns => [ 'external_body' ], rows => 1 })->single;
- if ( $problem ) {
- # If external_body, put as a body with ID 0 for the moment.
- $c->stash->{body} = $c->model('DB::Body')->new( { id => 0, name => $problem->external_body } );
- return;
- }
- }
-
# We must now have a string to check
my @bodies = $c->model('DB::Body')->search( { name => { -like => "$q_body%" } } )->all;
@@ -384,9 +374,6 @@ sub load_and_group_problems : Private {
{ 'like', $c->stash->{body}->id . ',%' },
{ 'like', '%,' . $c->stash->{body}->id },
];
- } elsif ($c->stash->{body} && $c->stash->{body}->id == 0) {
- # A proxy for an external_body
- $where->{'lower(external_body)'} = lc $c->stash->{body}->name;
} elsif ($c->stash->{body}) {
# XXX FixMyStreet used to have the following line so that reports not
# currently sent anywhere could still be listed in the appropriate
@@ -412,8 +399,7 @@ sub load_and_group_problems : Private {
my ( %problems, @pins );
while ( my $problem = $problems->next ) {
$c->log->debug( $problem->cobrand . ', cobrand is ' . $c->cobrand->moniker );
- if ( !$c->stash->{body} || !$c->stash->{body}->id ) {
- # An external_body entry
+ if ( !$c->stash->{body} ) {
add_row( $c, $problem, 0, \%problems, \@pins );
next;
}
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index e5a02c44c..0c8d567c4 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -729,15 +729,6 @@ sub default_map_zoom { undef };
sub users_can_hide { return 0; }
-=head2 reports_by_body
-
-Can /reports show reports indexed by external_body? This is a temporary measure
-until the contacts/area/body handling is rewritten to be better.
-
-=cut
-
-sub reports_by_body { 0; }
-
=head2 default_show_name
Returns true if the show name checkbox should be ticked by default.
diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
index f785f12a9..44c56887b 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
@@ -41,8 +41,6 @@ sub can_support_problems {
return 1;
}
-sub reports_by_body { 1 }
-
sub default_show_name {
my $self = shift;
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index 2ed5bc78b..5f25dfc70 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -138,19 +138,6 @@ sub send {
if ( $resp ) {
$row->external_id( $resp );
$row->send_method_used('Open311');
- if ($row->cobrand eq 'fixmybarangay') {
- # FixMyBarangay: currently the external bodies using Open311 are DPS, DEPW, DPWH
- # for now identify the latter two by their name in the service_code ($contact->email)
- # So: this works because we are anticipating the service codes for (e.g., potholes) look
- # like this:
- # POTDEPW or POTDPWH
- # (TODO: this will change when we have 'body' logic in place, meanwhile: hardcoded)
- if ($contact->email =~ /(DEPW|DPWH)$/i) {
- $row->external_body(uc $1); # body is DEPW (city roads) or DPWH (national roads)
- } else {
- $row->external_body("DPS"); # only other open311 dept is DPS
- }
- }
$result *= 0;
$self->success( 1 );
} else {
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index e4416f792..aae0940c7 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -88,13 +88,11 @@ sub update_comments {
next unless $request_id;
my $problem;
- my $criteria = { external_id => $request_id };
- if ($open311->jurisdiction =~ /^fixmybarangay_(dps|dpwh|depw)$/i) { # use jurisdiction (not area_id) for FMB bodies
- $criteria->{ external_body } = uc $1;
- } else {
+ my $criteria = {
+ external_id => $request_id,
# XXX This assumes that areas will actually only be one area.
- $criteria->{ bodies_str } = { like => '%' . join(",", keys %{$body_details->{areas}}) . '%' };
- }
+ bodies_str => { like => '%' . join(",", keys %{$body_details->{areas}}) . '%' },
+ };
$problem = FixMyStreet::App->model('DB::Problem')->search( $criteria );
if (my $p = $problem->first) {