aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Report/New.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2019-05-16 15:44:45 +0100
committerMatthew Somerville <matthew@mysociety.org>2019-06-17 14:24:22 +0100
commita2280170ea13758b6b9d042351801d81b576beeb (patch)
tree090e6e46fbafef6d1e5ab82d8f3c5b0c96af0fab /perllib/FixMyStreet/App/Controller/Report/New.pm
parentfd39e58506c712ce691a13485fa7f8184c22213a (diff)
display category under multiple groups
The group metadata of a contact can now be a comma separated list of groups under which to display the category For #2475
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Report/New.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index eb7934da3..7c7ebd202 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -744,8 +744,10 @@ sub setup_categories_and_bodies : Private {
if ( $c->cobrand->enable_category_groups ) {
my %category_groups = ();
for my $category (@category_options) {
- my $group = $category->{group} // $category->get_extra_metadata('group') // '';
- push @{$category_groups{$group}}, $category;
+ my $group = $category->{group} // $category->get_extra_metadata('group') // [''];
+ # this could be an array ref or a string
+ my @groups = ref $group eq 'ARRAY' ? @$group : ($group);
+ push( @{$category_groups{$_}}, $category ) for @groups;
}
my @category_groups = ();