aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Roles/ContactExtra.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Roles/ContactExtra.pm')
-rw-r--r--perllib/FixMyStreet/Roles/ContactExtra.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Roles/ContactExtra.pm b/perllib/FixMyStreet/Roles/ContactExtra.pm
index 55c055d99..e78d9b53f 100644
--- a/perllib/FixMyStreet/Roles/ContactExtra.pm
+++ b/perllib/FixMyStreet/Roles/ContactExtra.pm
@@ -25,8 +25,15 @@ sub for_bodies {
}
sub by_categories {
- my ($rs, $area_id, @contacts) = @_;
- my %body_ids = map { $_->body_id => 1 } FixMyStreet::DB->resultset('BodyArea')->search({ area_id => $area_id });
+ my ($rs, $contacts, %params) = @_;
+
+ my %body_ids = ();
+ if ( $params{body_id} ) {
+ %body_ids = ( $params{body_id} => 1 );
+ } else {
+ %body_ids = map { $_->body_id => 1 } FixMyStreet::DB->resultset('BodyArea')->search({ area_id => $params{area_id} });
+ }
+ my @contacts = @$contacts;
my @body_ids = keys %body_ids;
my %extras = ();
my @results = $rs->for_bodies(\@body_ids, undef);