aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm10
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm15
2 files changed, 24 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index c38c2b7da..d40a4c61d 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -587,6 +587,10 @@ sub reports : Path('reports') {
sub report_edit : Path('report_edit') : Args(1) {
my ( $self, $c, $id ) = @_;
+ if ( $c->cobrand->moniker eq 'zurich' ) {
+ $c->cobrand->admin_bodies();
+ }
+
my $site_restriction = $c->cobrand->site_restriction;
my $problem = $c->cobrand->problems->search(
@@ -660,6 +664,8 @@ sub report_edit : Path('report_edit') : Args(1) {
|| $c->req->param('email') ne $problem->user->email
|| $c->req->param('title') ne $problem->title
|| $c->req->param('detail') ne $problem->detail
+ || ($c->req->param('body') && $c->req->param('body') ne $problem->bodies_str)
+ || ($c->req->param('extra') && $c->req->param('extra') ne $problem->extra)
|| $flagged != $problem->flagged
|| $non_public != $problem->non_public )
{
@@ -669,8 +675,10 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->anonymous( $c->req->param('anonymous') );
$problem->title( $c->req->param('title') );
$problem->detail( $c->req->param('detail') );
- $problem->state( $c->req->param('state') );
+ $problem->state( $new_state );
$problem->name( $c->req->param('name') );
+ $problem->bodies_str( $c->req->param('body') ) if $c->req->param('body');
+ $problem->extra( $c->req->param('extra') ) if $c->req->param('extra');
$problem->flagged( $flagged );
$problem->non_public( $non_public );
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 73e36ebd4..d3cc638c1 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -1,6 +1,8 @@
package FixMyStreet::Cobrand::Zurich;
use base 'FixMyStreet::Cobrand::Default';
+use POSIX qw(strcoll);
+
use strict;
use warnings;
@@ -72,4 +74,17 @@ sub admin {
}
}
+sub admin_bodies {
+ my $self = shift;
+ my $c = $self->{c};
+ my $type = $self->admin_type();
+
+ if ($type eq 'dm') {
+ my $body = $c->stash->{body};
+ my @bodies = $c->model('DB::Body')->search( [ { id => $body->id }, { parent => $body->id } ] );
+ @bodies = sort { strcoll($a->name, $b->name) } @bodies;
+ $c->stash->{bodies} = \@bodies;
+ }
+}
+
1;