aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/IsleOfWight.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-02-27 07:39:46 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-27 07:39:46 +0000
commitb0b6810e372a154b1af7da72c1bd2143e5e251e9 (patch)
tree1ebbc91b59f8822e483e51f1f486c347718b0e65 /perllib/FixMyStreet/Cobrand/IsleOfWight.pm
parent152f8f4e608abc5029104e652f4ef37d4cfe02cb (diff)
parent18adbe946c1104338e6abff159b4f9877154969c (diff)
Merge branch 'admin-only-categories'
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/IsleOfWight.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/IsleOfWight.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Cobrand/IsleOfWight.pm b/perllib/FixMyStreet/Cobrand/IsleOfWight.pm
index a46b540ad..db0a20b9c 100644
--- a/perllib/FixMyStreet/Cobrand/IsleOfWight.pm
+++ b/perllib/FixMyStreet/Cobrand/IsleOfWight.pm
@@ -142,7 +142,7 @@ sub munge_load_and_group_problems {
return unless $where->{category};
- $where->{category} = $self->expand_triage_cat_list($where->{category});
+ $where->{category} = $self->_expand_triage_cat_list($where->{category});
}
sub munge_around_filter_category_list {
@@ -151,17 +151,21 @@ sub munge_around_filter_category_list {
my $c = $self->{c};
return unless $c->stash->{filter_category};
- my $cat_names = $self->expand_triage_cat_list([ keys %{$c->stash->{filter_category}} ]);
+ my $cat_names = $self->_expand_triage_cat_list([ keys %{$c->stash->{filter_category}} ]);
$c->stash->{filter_category} = { map { $_ => 1 } @$cat_names };
}
+sub _expand_triage_cat_list {
+ my ($self, $categories) = @_;
+ my $b = $self->{c}->model('DB::Body')->for_areas( $self->council_area_id )->first;
+ return $self->expand_triage_cat_list($categories, $b);
+}
+
# this assumes that each Triage category has the same name as a group
# and uses this to generate a list of categories that a triage category
# could be triaged to
sub expand_triage_cat_list {
- my ($self, $categories) = @_;
-
- my $b = $self->{c}->model('DB::Body')->for_areas( $self->council_area_id )->first;
+ my ($self, $categories, $b) = @_;
my $all_cats = $self->{c}->model('DB::Contact')->not_deleted->search(
{
@@ -190,7 +194,7 @@ sub expand_triage_cat_list {
my @cat_names;
while ( my $cat = $cats->next ) {
- if ( $cat->send_method eq 'Triage' ) {
+ if ( $cat->send_method && $cat->send_method eq 'Triage' ) {
# include the category itself
push @cat_names, $cat->category;
push @cat_names, @{ $group_to_category{$cat->category} } if $group_to_category{$cat->category};