aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-01-10 11:26:37 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-01-10 11:26:37 +0000
commit7996a7c5ac4d909ef1f73d39aa20f78d09a988dc (patch)
tree96d55facb3e4fd2ad105e090543107b1fdbac696
parent541a766ab93d213a410ecb06d36d03f4e32edbea (diff)
Move some Zurich specific things to Zurich cobrand file.
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm20
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm17
2 files changed, 17 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 8ed135e6d..e453a9565 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -661,11 +661,6 @@ sub report_edit : Path('report_edit') : Args(1) {
my $flagged = $c->req->param('flagged') ? 1 : 0;
my $non_public = $c->req->param('non_public') ? 1 : 0;
- # Predefine the hash so it's there for lookups
- # XXX Note you need to shallow copy each time you set it, due to a bug? in FilterColumn.
- my $extra = $problem->extra || {};
- $extra->{internal_notes} ||= '';
-
# do this here so before we update the values in problem
if ( $c->req->param('anonymous') ne $problem->anonymous
|| $c->req->param('name') ne $problem->name
@@ -673,8 +668,6 @@ sub report_edit : Path('report_edit') : Args(1) {
|| $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('internal_notes') && $c->req->param('internal_notes') ne $extra->{internal_notes})
- || ($c->cobrand->moniker eq 'zurich' && $c->req->param('publish_photo') ne $extra->{publish_photo})
|| $flagged != $problem->flagged
|| $non_public != $problem->non_public )
{
@@ -687,19 +680,6 @@ sub report_edit : Path('report_edit') : Args(1) {
$problem->state( $new_state );
$problem->name( $c->req->param('name') );
$problem->bodies_str( $c->req->param('body') ) if $c->req->param('body');
- if ($c->req->param('internal_notes')) {
- $extra->{internal_notes} = $c->req->param('internal_notes');
- $problem->extra( { %$extra } );
- }
-
- # Zurich have photos being published or not, and third parties getting
- # personal data; can't just check as with e.g. internal_notes as it's a
- # checkbox and won't be set if it's not ticked
- if ($c->cobrand->moniker eq 'zurich') {
- $extra->{publish_photo} = $c->req->params->{publish_photo} || 0;
- $extra->{third_personal} = $c->req->params->{third_personal} || 0;
- $problem->extra( { %$extra } );
- }
$problem->flagged( $flagged );
$problem->non_public( $non_public );
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 455e2bbbb..9e9d8542a 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -121,6 +121,23 @@ sub admin_report_edit {
unless $allowed_bodies{$problem->bodies_str};
}
+ # Problem updates upon submission
+ if ( ($type eq 'super' || $type eq 'dm') && $c->req->param('submit') ) {
+ $c->forward('check_token');
+
+ # Predefine the hash so it's there for lookups
+ # XXX Note you need to shallow copy each time you set it, due to a bug? in FilterColumn.
+ my $extra = $problem->extra || {};
+
+ $extra->{internal_notes} = $c->req->param('internal_notes');
+ $extra->{publish_photo} = $c->req->params->{publish_photo} || 0;
+ $extra->{third_personal} = $c->req->params->{third_personal} || 0;
+ $problem->extra( { %$extra } );
+
+ $problem->lastupdate( \'ms_current_timestamp()' );
+ $problem->update;
+ }
+
if ($type eq 'super') {
my @bodies = $c->model('DB::Body')->all();