diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 539c21d76..fc16dcf8d 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -131,8 +131,12 @@ sub admin_report_edit { } elsif ($type eq 'dm') { - # Can assign to other DMs, and their own subdivisions - my @bodies = $c->model('DB::Body')->search( [ { parent => $body->parent->id }, { parent => $body->id } ] ); + # Can assign to: + my @bodies = $c->model('DB::Body')->search( [ + { 'me.parent' => $body->parent->id }, # Other DMs on the same level + { 'me.parent' => $body->id }, # Their subdivisions + { 'me.parent' => undef, 'bodies.id' => undef }, # External bodies + ], { join => 'bodies', distinct => 1 } ); @bodies = sort { strcoll($a->name, $b->name) } @bodies; $c->stash->{bodies} = \@bodies; |