diff options
author | Dave Whiteland <dave@mysociety.org> | 2013-01-20 20:45:37 +0000 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2013-01-20 20:45:37 +0000 |
commit | d12a2ea5c495f6c6a8cc3a95b5c7ea3df129190d (patch) | |
tree | dc92124cf10bc9f2e7c3d96a7bb0166c06cd27ed | |
parent | 12f2f636c1b423ed9baefb1961956a1774fff137 (diff) |
use jurisdiction to identify external bodies for FixMyBarangay's status updates coming from endpoints in devolved contacts
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index 0b4e037fd..76904b7d2 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -80,12 +80,14 @@ sub update_comments { # what problem it belongs to so just skip next unless $request_id; - my $problem = - FixMyStreet::App->model('DB::Problem') - ->search( { - external_id => $request_id, - council => { like => '%' . $council_details->{areaid} . '%' }, - } ); + 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 { + $criteria->{ council } = { like => '%' . $council_details->{areaid} . '%' }; + } + $problem = FixMyStreet::App->model('DB::Problem')->search( $criteria ); if (my $p = $problem->first) { my $c = $p->comments->search( { external_id => $request->{update_id} } ); |