aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-05 16:55:26 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-05 16:55:26 +0000
commitf496a9f843738879e84bea6aae72eab4165a3dca (patch)
tree89d20e84713a4af1075b11723052bbd2ba852329 /perllib
parent1a676c6a7b4eb01e022459e267270a020b70aa94 (diff)
Do problem search lookup in database, not in template.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm25
1 files changed, 22 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index faad88f1f..5e177f000 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -527,10 +527,29 @@ sub reports : Path('reports') {
cobrand_data => { like => $like_search },
];
}
+
+ if ( $c->cobrand->moniker eq 'zurich' ) {
+ my $type = $c->stash->{admin_type};
+ my $body = $c->stash->{body};
+ if ( $type eq 'super' ) {
+ $query = { -or => $query };
+ } elsif ( $type eq 'dm' ) {
+ my @children = map { $_->id } $body->bodies->all;
+ my @all = (@children, $body->id);
+ $query = {
+ bodies_str => \@all,
+ -or => $query
+ };
+ } elsif ( $type eq 'sdm' ) {
+ $query = { bodies_str => $body->id, -or => $query };
+ }
+ } else {
+ $query = { -or => $query };
+ }
+
+
my $problems = $c->cobrand->problems->search(
- {
- -or => $query,
- },
+ $query,
{
prefetch => 'user',
order_by => [\"(state='hidden')",'created']