aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/Bodies.pm9
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/BathNES.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Borsetshire.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Buckinghamshire.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm24
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Lincolnshire.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/Northamptonshire.pm2
9 files changed, 36 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
index 0e47d2238..2ff69b3b5 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
@@ -273,8 +273,13 @@ sub update_contacts : Private {
if ( $c->get_param('reputation_threshold') ) {
$contact->set_extra_metadata( reputation_threshold => int($c->get_param('reputation_threshold')) );
}
- if ( my $group = $c->get_param('group') ) {
- $contact->set_extra_metadata( group => $group );
+ if ( my @group = $c->get_param_list('group') ) {
+ @group = grep { $_ } @group;
+ if (scalar @group == 0) {
+ $contact->unset_extra_metadata( 'group' );
+ } else {
+ $contact->set_extra_metadata( group => \@group );
+ }
} else {
$contact->unset_extra_metadata( 'group' );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 6a6040865..7c7ebd202 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -741,11 +741,13 @@ sub setup_categories_and_bodies : Private {
$c->stash->{missing_details_bodies} = \@missing_details_bodies;
$c->stash->{missing_details_body_names} = \@missing_details_body_names;
- if ( $c->cobrand->call_hook('enable_category_groups') ) {
+ 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 = ();
diff --git a/perllib/FixMyStreet/Cobrand/BathNES.pm b/perllib/FixMyStreet/Cobrand/BathNES.pm
index d726c671e..ea9b26e7a 100644
--- a/perllib/FixMyStreet/Cobrand/BathNES.pm
+++ b/perllib/FixMyStreet/Cobrand/BathNES.pm
@@ -74,8 +74,6 @@ sub pin_colour {
sub send_questionnaires { 0 }
-sub enable_category_groups { 1 }
-
sub default_map_zoom { 3 }
sub map_js_extra {
diff --git a/perllib/FixMyStreet/Cobrand/Borsetshire.pm b/perllib/FixMyStreet/Cobrand/Borsetshire.pm
index a99d2e7b4..f8650169d 100644
--- a/perllib/FixMyStreet/Cobrand/Borsetshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Borsetshire.pm
@@ -27,6 +27,4 @@ sub send_questionnaires {
sub bypass_password_checks { 1 }
-sub enable_category_groups { 1 }
-
1;
diff --git a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
index 486e9603d..4c1d0108b 100644
--- a/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Buckinghamshire.pm
@@ -185,8 +185,6 @@ sub map_type { 'Buckinghamshire' }
sub default_map_zoom { 3 }
-sub enable_category_groups { 1 }
-
sub _dashboard_export_add_columns {
my $self = shift;
my $c = $self->{c};
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index cc7f03adb..eaf27e3bc 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -1085,6 +1085,30 @@ sub show_unconfirmed_reports {
0;
}
+=item enable_category_groups
+
+Whether body category groups should be displayed on the new report form. If this is
+not enabled then any groups will be ignored and a flat list of categories displayed.
+
+=cut
+
+sub enable_category_groups {
+ my $self = shift;
+ return $self->feature('category_groups');
+}
+
+=item enable_multiple_category_groups
+
+Whether a category can be included in multiple groups. Required enable_category_groups
+to alse be true.
+
+=cut
+
+sub enable_multiple_category_groups {
+ my $self = shift;
+ return $self->enable_category_groups && $self->feature('multiple_category_groups');
+}
+
sub default_problem_state { 'unconfirmed' }
sub state_groups_admin {
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index e01f3e23b..7c51eddd1 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -10,8 +10,6 @@ use constant COUNCIL_ID_BROMLEY => 2482;
sub on_map_default_status { return 'open'; }
-sub enable_category_groups { 1 }
-
# Special extra
sub path_to_web_templates {
my $self = shift;
diff --git a/perllib/FixMyStreet/Cobrand/Lincolnshire.pm b/perllib/FixMyStreet/Cobrand/Lincolnshire.pm
index 3b731b273..ca88f6b8e 100644
--- a/perllib/FixMyStreet/Cobrand/Lincolnshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Lincolnshire.pm
@@ -18,7 +18,6 @@ sub council_name { return 'Lincolnshire County Council'; }
sub council_url { return 'lincolnshire'; }
sub is_two_tier { 1 }
-sub enable_category_groups { 1 }
sub send_questionnaires { 0 }
sub report_sent_confirmation_email { 'external_id' }
diff --git a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
index 3d5d4b6f2..21a145326 100644
--- a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
+++ b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm
@@ -47,8 +47,6 @@ sub privacy_policy_url {
'https://www3.northamptonshire.gov.uk/councilservices/council-and-democracy/transparency/information-policies/privacy-notice/place/Pages/street-doctor.aspx'
}
-sub enable_category_groups { 1 }
-
sub is_two_tier { 1 }
sub get_geocoder { 'OSM' }