diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-08 23:02:37 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:03:30 +0100 |
commit | 426bc926a422af21ff39cebed836d34e46238500 (patch) | |
tree | 02d43a11dae6cbfc443eb5476c6c708f1eb52377 /perllib | |
parent | 466c5cac0f000bfa80ab49c88ec6e03c388ac328 (diff) |
Only use active categories for making new reports.
Inactive ones can still be used for e.g. list filtering,
but not when making a new report.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Contact.pm | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index 6829e01ae..a5f4a53e7 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -160,7 +160,7 @@ sub get_services : Private { my $lon = $c->get_param('long') || ''; # Look up categories for this council or councils - my $categories = $c->model('DB::Contact')->not_deleted; + my $categories = $c->model('DB::Contact')->active; if ($lat || $lon) { my $area_types = $c->cobrand->area_types; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 1d322e88c..3acb385bd 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -605,7 +605,7 @@ sub setup_categories_and_bodies : Private { my $contacts # = $c # ->model('DB::Contact') # - ->not_deleted # + ->active ->search( { body_id => [ keys %bodies ] } ); my @contacts = $c->cobrand->categories_restriction($contacts)->all; diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm index d32453942..8ef6d1ac5 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Contact.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm @@ -19,6 +19,11 @@ sub not_deleted { return $rs->search( { $rs->me('state') => { '!=' => 'deleted' } } ); } +sub active { + my $rs = shift; + $rs->search( { $rs->me('state') => [ 'unconfirmed', 'confirmed' ] } ); +} + sub summary_count { my ( $rs, $restriction ) = @_; |